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:

  • An assistant can make up a name that fits: a method, a function, a library's function. This is called a hallucination, and it's written just as surely as the rest. A name that doesn't exist stops the program with an error such as AttributeError.
  • Send the assistant the program and what it printed, and ask for a version with only what you know: every name in it is then one you can check.
  • Some errors say that something isn't here, not that it doesn't exist: FileNotFoundError for a file, ModuleNotFoundError for a library. Only you know where your program runs, so say it.
  • An assistant knows Python and its libraries as they were in the texts it learned from. When code for a library says a name doesn't exist, look it up in the documentation of your version, and tell the assistant which version you have.
  • A claim about how Python works is checked by running it: an experiment of a few lines, on data where you know the answer. Asking the assistant whether it's sure gets you more words, not a result.

Practice it all at once. The program in the editor is another answer someone got, this time for Mia's longest walk. Her walks last week were 40, 25, 55 and 30 minutes. The error it ends with shows one thing wrong with it, and that isn't the only one.

Next comes a small project, Checkpoint: The Week's Report, where you build Mia's report for a week in steps and check it with tests.

Instructions

  1. 1

    Run the program, attach script.py and what it printed, and say where the program runs. Give Mia's walks, and ask for a version that works there. Then send it.

  2. 2

    Paste the program from the answer in place of yours and run it. It prints Walks: 4 and Longest: 55.

Back

6/6

  1. 1. A Method That Doesn't Exist
  2. 2. Things That Aren't Here
  3. 3. Quiz: An Older Version
  4. 4. Try It in Three Lines
  5. 5. Quiz: Check the Claim
  6. 6. Summary
Next

Start programming for free

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

Or sign up with: