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:

  • The AI can't run your program. When it ends with an error, send the program and the whole error, with the button on the console. The error says what went wrong and where the program stopped; the mistake is often on that line, but it can be on one that ran before it.
  • When the program runs and its result is wrong, nothing tells the AI so. Say what the program prints and what you expected instead, with the numbers, and why, when it depends on a rule the AI can't know.
  • When a fix doesn't work, go on in the same chat: attach the program again, and say what you changed and what it does now. Python stops at the first error, so one mistake can hide another, and an error can go away while the result stays wrong. Check the result again.
  • Ask for the smallest change: which line, how and why. A whole new program hides what was wrong, and it can change lines that were fine.

Practice it all at once. Mia's program prints one number and then ends with an error about NoneType, on a line that looks right.

Next comes a small project, Checkpoint: The Price List, where you build Mia's price list with the AI, one function at a time.

Instructions

  1. 1

    Run the program. Attach script.py and what it printed, and ask which line to change and why. Ask for only that line, not the whole program again. Then send it.

  2. 2

    Change that line, keep the list of walks as it is, and run the program. It prints Walks: 4 and Total: 36.

Back

7/7

  1. 1. The Whole Error
  2. 2. No Error, a Wrong Result
  3. 3. Quiz: Which Message Helps
  4. 4. The Fix Didn't Work
  5. 5. Quiz: Half a Fix
  6. 6. The Smallest Change
  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: