<jupyter_start><jupyter_text>ASSIGNMENT CONFIGrequirements: requirements.txtsolutions_pdf: trueexport_cell:    instructions: "These are some submission instructions."generate:     pdf: true    filtering: true    pagebreaks: true    zips: false<jupyter_code># Otter-Grader Tutorial

This notebook is part of the Otter-Grader tutorial. For more information about Otter, see our [documentation](https://otter-grader.rtfd.io).<jupyter_output><empty_output><jupyter_text>import pandas as pdimport numpy as np%matplotlib inlineimport ottergrader = otter.Notebook()<jupyter_code># BEGIN QUESTION
name: q1<jupyter_output><empty_output><jupyter_text>**Question 1:** Write a function `square` that returns the square of its argument.<jupyter_code># BEGIN SOLUTION<jupyter_output><empty_output><jupyter_text>def square(x):    return x**2  SOLUTION<jupyter_code># END SOLUTION
# BEGIN TESTS<jupyter_output><empty_output><jupyter_text>square(1) == 1 square(0) == 0  HIDDENsquare(2.5) == 6.25<jupyter_code># END TESTS
# END QUESTION
# BEGIN QUESTION
name: q2<jupyter_output><empty_output><jupyter_text>**Question 2:** Write an infinite generator of the Fibonacci sequence `fiberator` that is *not* recursive.<jupyter_code># BEGIN SOLUTION<jupyter_output><empty_output><jupyter_text>def fiberator():     BEGIN SOLUTION    yield 0    yield 1    x, y = 0, 1    while True:        x, y = y, x + y        yield y     END SOLUTION<jupyter_code># END SOLUTION
# BEGIN TESTS<jupyter_output><empty_output><jupyter_text>f = fiberator()assert next(f) == 0assert next(f) == 1  HIDDENf = fiberator()assert next(f) == 0assert next(f) == 1assert next(f) == 1assert next(f) == 2assert next(f) == 3assert next(f) == 5assert next(f) == 8assert next(f) == 13assert next(f) == 21<jupyter_code># END TESTS
# END QUESTION
# BEGIN QUESTION
name: q3<jupyter_output><empty_output><jupyter_text>**Question 3:** Create a DataFrame mirroring the table below and assign this to `data`. Then group by the `flavor` column and find the mean price for each flavor; assign this **series** to `price_by_flavor`.| flavor | scoops | price ||-----|-----|-----|| chocolate | 1 | 2 || vanilla | 1 | 1.5 || chocolate | 2 | 3 || strawberry | 1 | 2 || strawberry | 3 | 4 || vanilla | 2 | 2 || mint | 1 | 4 || mint | 2 | 5 || chocolate | 3 | 5 |<jupyter_code># BEGIN SOLUTION<jupyter_output><empty_output><jupyter_text>BEGIN SOLUTION NO PROMPTdata = pd.DataFrame({    "flavor": ["chocolate", "vanilla", "chocolate", "strawberry", "strawberry", "vanilla", "mint",                "mint", "chocolate"],    "scoops": [1, 1, 2, 1, 3, 2, 1, 2, 3],    "price": [2, 1.5, 3, 2, 4, 2, 4, 5, 5]})price_by_flavor = data.groupby("flavor").mean()["price"] END SOLUTION"""  BEGIN PROMPTdata = ...price_by_flavor = ..."""  END PROMPTprice_by_flavor<jupyter_code># END SOLUTION
# BEGIN TESTS<jupyter_output><empty_output><jupyter_text>len(data["flavor"].unique()) == 4 for l in ["chocolate", "vanilla", "strawberry", "mint"]:    assert l in data["flavor"].unique() assert type(price_by_flavor) == pd.Series assert len(price_by_flavor) == 4  HIDDENnp.isclose(price_by_flavor["chocolate"], 3.33333333)  HIDDENnp.isclose(price_by_flavor["mint"], 4.5)  HIDDENnp.isclose(price_by_flavor["strawberry"], 3)  HIDDENnp.isclose(price_by_flavor["vanilla"], 1.75)<jupyter_code># END TESTS
# END QUESTION
# BEGIN QUESTION
name: q4
manual: true<jupyter_output><empty_output><jupyter_text>**Question 4:** Create a barplot of `price_by_flavor`.<jupyter_code># BEGIN SOLUTION<jupyter_output><empty_output><jupyter_text>price_by_flavor.plot.bar();  SOLUTION<jupyter_code># END SOLUTION
# END QUESTION
# BEGIN QUESTION
name: q5
manual: true<jupyter_output><empty_output><jupyter_text>**Question 5:** What do you notice about the bar plot?<jupyter_code># BEGIN SOLUTION<jupyter_output><empty_output><jupyter_text>**SOLUTION:** mint is the highest...?<jupyter_code># END SOLUTION
# END QUESTION<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1430753564154786, 'fraction_numerical': 0.023421588594704685, 'mean_word_length': 5.966312056737588, 'pattern_counts': {'":': 3, '<': 61, '<?xml version=': 0, '>': 61, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '15', 'dir': 'jupyter-structured-clean-dedup', 'id': '242716', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1555, 'n_tokens_neox': 1426, 'n_words': 344, 'path': 'docs/tutorial/demo.ipynb', 'repo_name': 'chrispyles/otter-grader', 'size': '3928'}