← return to practice.dsc10.com
This quiz was administered in-person. Students were allowed 1
double-sided cheatsheet. Students had 20 minutes to
work on the quiz.
This quiz covered Lectures 6-10 of the Fall 2025 offering of
DSC 10.
The DataFrame chipotle contains information about all
ingredients on the menu at the Chipotle restaurant chain. The DataFrame
is indexed by ingredient "name" (str), and also includes
each ingredient’s "calories" (int), "protein"
content in grams (str), "type" (str: either
"meat", "base", or "veggie"), and
"spice_level" (int: either 0, 1, 2, or 3). The
chipotle DataFrame has 30 rows, with the first 5 shown.

For a typical diet, the recommended daily protein intake is 80 g.
Fill in the blanks in the code below to add a new column to
chipotle that contains values 0 to 100 representing the
percentage of the recommended daily protein intake each ingredient
provides.
def clean_protein(grams):
return int(grams.split(" ")[__(a)__]) / __(b)__ * 100
chipotle = chipotle.assign(protein_percent = __(c)__)
(a): 0
(b): 80
(c):
chipotle.get("protein").apply(clean_protein)
The average score on this problem was 88%.
Below is a density histogram showing the distribution of calories for
all 30 ingredients in chipotle.

How many ingredients have less than 160 calories?
Answer: 12
The average score on this problem was 83%.
Suppose we had plotted the histogram with the argument
bins=[120, 160, 190, 210].
(i): 3
(ii): 0.01
The average score on this problem was 63%.
What is the maximum possible number of rows in the DataFrame that results from the expression below?
chipotle.groupby(["spice_level", "type"]).mean()
Answer: 12
The average score on this problem was 58%.
Our tutor Noah ate at Chipotle ten times last month (he loves
Chipotle). Each time, Noah only ordered one item, either guacamole,
barbacoa, or steak. The DataFrame below, called
noahs_meals, shows what he ordered.

Suppose we run the code below.
first_five = chipotle.take(np.arange(5))
first_five.merge(noahs_meals, on = "type")
How many rows does the resulting DataFrame contain?
Answer: 17
The average score on this problem was 42%.
Use the scatterplot of all 30 ingredients to determine how many have a calorie-to-protein ratio that is at least 5.

Answer: 26
The average score on this problem was 73%.
Let calories and protein be
numpy arrays containing the calorie and protein amounts, as
ints, for each of the 30 ingredients in chipotle. Fill in
the blanks so that the code below calculates the number of ingredients
with a calorie-to-protein ratio of at least 5.
count = __(a)__
for i in np.arange(__(b)__):
if calories[i] / protein[i] >= 5:
count = __(c)__
(a): 0
(b): len(calories)
(c): count + 1
The average score on this problem was 76%.