Information about cookies on this page

Our website uses cookies to ensure the functionality of the website, to collect and analyze information about the performance and usage of the website. Privacy Policy

  • Courses
    • Discord
    • Twitter
    • Linkedin
    • Facebook
    • Instagram
  • Pricing
  • English
  • Čeština
  • Deutsch
  • Русский
Sign inStart free
  • Courses
  • Pricing

Community

Sign in
  
  • Courses
    • Discord
    • Twitter
    • Linkedin
    • Facebook
    • Instagram
  • Pricing
  • English
  • Čeština
  • Deutsch
  • Русский
Sign inStart free
  • Courses
  • Pricing

Community

Sign in

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. 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 is Rex (45 min): 12 and the last Max (20 min): 6. Keep the lines of the list as they are: the exercise also runs the program with other walks.

  2. 2

    Add up the prices in the loop, and after it print the day's total: Total: 57.

Back

4/4

  1. 1. The Price of a Walk
  2. 2. Three Dogs
  3. 3. The Mistake in the Discount
  4. 4. Saturday
Next

Start programming for free

By signing up, you agree to the Terms of Service and Privacy Policy.

Or sign up with: