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

Summary

In this lesson, you learned that:

  • A program you get in one piece is hard to check: when it's wrong, the mistake can be in any line. Build it in small steps instead.
  • Start with a plan: the steps in order, each small enough to write and check on its own. Say that you don't want any code yet, or you may get it with the plan.
  • Ask for one piece at a time, and say that you want nothing else yet. Paste it, run the program and check the new line by hand before the next piece. Then a wrong line points to the piece you've just added.
  • When you ask for a change, say where it goes and what stays as it is, by name. After pasting, check that the rest is as it was.
  • The assistant knows your program as it was when it last saw it, so attach it again after you change it yourself. When a chat has grown long, with many versions of the program in it, start a new chat: attach the program as it is now and say in a sentence what it does.

Practice it all at once. Mia would like the report to show what she would have earned without the discount, too. The chat here is new, and the program in the editor is the report as you left it.

Next comes Tests Come First: examples that check a function every time you run the program, written before the function itself.

Instructions

  1. 1

    Attach script.py and ask for only that piece: a function full_price(walks) that adds up the prices of the walks without the discount, and a line at the end of print_report() that prints it after Full price:. Say that week_total() and the rest stay as they are. Then send it.

  2. 2

    Paste the function and the line into your program, and run it. The report ends with Full price: 56, five more than the total.

Back

7/7

  1. 1. A Plan Before Code
  2. 2. One Piece at a Time
  3. 3. Quiz: The Piece Just Added
  4. 4. Leave the Rest as It Is
  5. 5. A New Chat
  6. 6. Quiz: A Long Chat
  7. 7. Summary
Next

Start programming for free

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

Or sign up with: