← return to practice.dsc10.com

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.

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.

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

**Answer**:

`a`

:`"Cost"`

`b`

:`count`

`c`

:`0`

`d`

:`items.get("Cost") == 0`

The average score on this problem was 81%.

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.

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

**Answer**: 10

The average score on this problem was 54%.

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

**Answer**: Bar chart

The average score on this problem was 74%.

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**.

**Answer**: 80%

The average score on this problem was 73%.

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):
= 0
bells for nook in np.arange(crossing):
if nook % 2 == 0:
= bells + 1
bells else:
= bells - 2
bells return bells
```

What value does `tom_nook(8)`

evaluate to?

-6

-4

-2

0

2

4

6

**Answer**: -4

The average score on this problem was 79%.