# Fall 2023 Quiz 2

This quiz was administered in-person. It was closed-book and closed-note; students were not allowed to use the DSC 10 Reference Sheet. Students had 20 minutes to work on the quiz.

This quiz covered Lectures 5-10 of the Fall 2023 offering of DSC 10.

The DataFrame items describes various items available to collect or purchase using bells, the currency used in the game Animal Crossing: New Horizons.

For each item, we have:

• "Item" (str): The name of the item.
• "Cost" (int): The cost of the item in bells. Items that cost 0 bells cannot be purchased and must be collected through other means (such as crafting).
• "Location" (str): The store or action through which the item can be obtained.

The first 6 rows of items are below, though items has more rows than are shown here.

## Problem 1

Fill in the blanks so that count_1 and count_2 both evaluate to the number of items in items with a "Cost" of 0.

count_1 = items.groupby(__(a)__).__(b)__().get("Item").loc[__(c)__]
count_2 = items[__(d)__].shape[0]

• a: "Cost"
• b: count
• c: 0
• d: items.get("Cost") == 0

##### Difficulty: ⭐️⭐️

The average score on this problem was 81%.

## Problem 2

The DataFrame keepers has 5 rows, each of which represent a different shopkeeper in the Animal Crossing: New Horizons universe.

keepers is shown below in its entirety.

How many rows are in the following DataFrame? Give your answer as an integer.

keepers.merge(items.take(np.arange(6)),
left_on="Store",
right_on="Location")

##### Difficulty: ⭐️⭐️⭐️

The average score on this problem was 54%.

## Problem 3

Which type of plot should we use to visualize the distribution of the "Location" column in the items DataFrame?

• Scatter plot

• Line plot

• Bar chart

• Histogram

##### Difficulty: ⭐️⭐️⭐️

The average score on this problem was 74%.

## Problem 4

Nintendo collected data on the heights of a sample of Animal Crossing: New Horizons players. A histogram of the heights in their sample is given below.

What percentage of players in Nintendo’s sample are at least 62.5 inches tall? Give your answer as an integer rounded to the nearest multiple of 5.

##### Difficulty: ⭐️⭐️⭐️

The average score on this problem was 73%.

## Problem 5

Consider the function tom_nook, defined below. Recall that if x is an integer, x % 2 is 0 if x is even and 1 if x is odd.

def tom_nook(crossing):
bells = 0
for nook in np.arange(crossing):
if nook % 2 == 0:
bells = bells + 1
else:
bells = bells - 2
return bells

What value does tom_nook(8) evaluate to?

• -6

• -4

• -2

• 0

• 2

• 4

• 6