Tasting Score Spread
Problem
You are given a DataFrame `entry` with columns `entry_id`, `roaster`, `aroma`, `body`, and `finish`. `entry_id` is unique. Each row is a coffee entered in a cupping contest, rated by judges on three attributes: `aroma`, `body`, and `finish`.
Each entry's total is the sum of its three attribute ratings. Return a single value in a column named `score_spread`, equal to the difference between the highest total score and the lowest total score across all entries.
Input data
Example rows — the live problem includes the full dataset.
| entry_id | roaster | aroma | body | finish |
|---|---|---|---|---|
| 1 | Highland | 8 | 7 | 9 |
| 2 | Riverbend | 6 | 6 | 5 |
| 3 | Coastline | 9 | 9 | 8 |
| 4 | Summit | 4 | 5 | 3 |
Expected output
Your answer should return 1 row with the columns score_spread.
Starter code (Pandas (Python))
import pandas as pd
def tasting_score_spread(entry) -> pd.DataFrame:
# Your code here
return entrySolve 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