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

The Fix Didn't Work

Fixing one mistake doesn't make a program right. Python stops at the first error, so another mistake further on shows only once the first is gone. Or the error goes away, and the result is still wrong. Either way, the conversation isn't over.

Go on in the same chat. The AI still has your program, the error and what it suggested, so you only add what's new: the program as it is now, attached again, what it prints now, and what you changed. If the result is wrong, say what you expected, and why: the AI doesn't know how Mia charges, and without that, it may decide that your sum is what's wrong. A new chat starts from nothing, and “It still doesn't work” leaves the AI to guess what happened in your editor.

Mia's program works out what this week's walks cost. She charges each walk on its own: 6 for every started half hour of that walk. The program ends with an error. Once it runs, don't take its result on trust, even if the answer said what it would print: check the total by hand.

Instructions

  1. 1

    Run the program: it ends with an error. Attach script.py and what it printed, and ask what's wrong. Then send it.

  2. 2

    Make the change the answer gives for the line in the error, and run the program. There's no error now, and it prints Total: 36. Check it by hand: walks of 45, 20, 45 and 50 minutes cost 12 + 6 + 12 + 12 = 42. In the same chat, attach script.py again, and say what you changed, what it prints now, and what you expected and why. Then send it.

  3. 3

    Change the program as the answer says, keep the list of walks as it is, and run it. It prints Walks: 4 and Total: 42.

Back

4/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: