The Busiest Day
The last piece is the busiest day, the day with the most minutes of walks. Mia asked for it in a new chat and put the function from the answer she got under longest_walk(), with a line at the end of the program that prints it. busiest_day() adds up each day's minutes in a dictionary, as minutes_per_dog() does for each dog, so you can read that part now. Then it picks the busiest day with a method you haven't seen: most_common().
Nothing in the code tells you whether that method exists: a made-up name looks just like a real one. That's why Mia gave the piece a test as soon as she pasted it, as you did with the others: print(busiest_day(test_week) == "Tue"), under the other tests. If the method is made up, that test is where the program stops.
If it's made up, do what you did in When It Makes Things Up: send the program with what it printed, and ask for a version with only what you know, so that every name in it is one you can check.
Once it runs, the report is finished: four pieces, each with its own test. Three count with a dictionary, which you learned from an answer, and one you wrote yourself. Next comes A Tutor, Not a Homework Machine: how to have the assistant help you learn instead of doing the work for you.
Instructions
- 1
Run the program. Attach
script.pyand what it printed (Attach to message on the console), ask whether a dictionary really hasmost_common(), and ask for abusiest_day()with only what you know: lists, loops,if, functions and the dictionaries ofminutes_per_dog(). Then send it. - 2
Paste the new
busiest_day()in place of the old one and run the program. The tests printTrue, Mia's new one too, and the report ends withBusiest day: Wed.