The lights in Mission Control dim, and the big screen shows a list of twelve weeks. Every program the crew wrote is there, from a single print line to Mission Log.
Rocket reads the list from the top. "Hello, Mission Control," he says, laughing. "I remember being amazed that the shell answered 2 plus 3."
Raven reads from the bottom. "What do you notice?" she asks. "Every week used the weeks before it. Mission Log has a piece of every single one."
Nova rises above the crew and her lights burst into a slow spiral of cyan and gold. "Great discovery," she says softly. "You did not just learn Python. You learned how to learn the next thing."
Rocket and Raven turn to the screen and read out one last line together.
| Week | You learned | Where it lives in Mission Log |
|---|---|---|
| 1 | print, comments, reading errors | Comments at the top, every message |
| 2 | variables, input, f-strings | add_entry and format_entry |
| 3 | if, elif, else | The menu choices |
| 4 | loops and break | while True and break in main |
| 5 | lists and dictionaries | Each entry, and the list of entries |
| 6 | functions and modules | Eleven functions, imported by the tests |
| 7 | the standard library | date.today() for each entry |
| 8 | files and with | open in load_entries and save_entries |
| 9 | JSON | mission_log.json |
| 10 | try, except and assert | load_entries and test_mission_log.py |
| 11 | decomposing a project | The plan and the menu |
| 12 | edge cases, snapshots, demos | mission_log_v1.py and your demo |
Before the final Crew Quest, read this program and predict its output. It uses ideas from almost every week of the course.
# final_review.py
def busiest(counts):
"""The tag with the highest count."""
best = ""
for tag, n in counts.items():
if best == "" or n > counts[best]:
best = tag
return best
tags = ["build", "test", "build", "idea"]
counts = {}
for tag in tags:
counts[tag] = counts.get(tag, 0) + 1
print(counts)
print("Busiest tag:", busiest(counts)) | Statement | True or false? |
|---|---|
| busiest returns a value instead of printing it. | ? |
| The docstring changes what busiest does. | ? |
| for tag, n in counts.items() gives each key and value. | ? |
| This program needs a file to run. | ? |
| You could test busiest with assert busiest({"a": 1}) == "a". | ? |
You did it. Every line of Mission Log is yours. Tomorrow is the final Crew Quest.