Build a Savory-and-Sweet Combo
Problem
You are given a DataFrame `dish` describing a cafe menu. It has columns `dish_name`, `flavor` (one of 'Savory', 'Sweet', or 'Drink'), and `calories`.
A combo deal pairs one savory dish with one sweet dish. List every possible combo: each pairing of a 'Savory' dish with a 'Sweet' dish.
Return two columns, `savory` and `sweet`, holding the two dish names. The result may be returned in any order.
Input data
Example rows — the live problem includes the full dataset.
| dish_name | flavor | calories |
|---|---|---|
| Latte | Drink | 120 |
| Quiche | Savory | 310 |
| Panini | Savory | 420 |
| Frittata | Savory | 280 |
| Brownie | Sweet | 260 |
Expected output
Your answer should return 9 rows with the columns savory, sweet.
Starter code (Pandas (Python))
import pandas as pd
def build_savory_sweet_combo(dish) -> pd.DataFrame:
# Your code here
return dishSolve this Pandas question free
Write Pandas (Python) and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock