Saturday
Now the prices are right for any number of dogs. One more thing, and the price list is done: what Mia earned on Saturday. Her walks that day are in a list at the end of the program, one list for each walk: the dogs, the minutes and the number of dogs.
This part is a loop and a total, which you've written many times in the Python course. Write it yourself, or ask the assistant for it with the program attached and an example of the lines you want. Either way, check the total by hand before you believe it: four prices are quick to add up.
That's the whole project. With an assistant beside you, you've built a price list Mia can trust. You described a function with examples instead of asking vaguely, tried the case her message to the assistant didn't name, found the mistake in the discount and fixed it with the smallest change, and checked every price by running the program. In the next lesson, Build in Small Steps, you'll build a longer program with the assistant, one piece at a time.
Instructions
- 1
Under the list, print a line for each of Saturday's walks with its dogs, its minutes and its price from
dogs_price(). The first line isRex (45 min): 12and the lastMax (20 min): 6. Keep the lines of the list as they are: the exercise also runs the program with other walks. - 2
Add up the prices in the loop, and after it print the day's total:
Total: 57.