Omniadisce

Computational physics 1.7: Reading errors

Lesson Beginner

Join free to take this lesson

Anyone can look around, but taking a lesson needs a free account. With one, your answers are checked step by step and your progress is saved, so you can stop and pick up where you left off on any device.

12 steps ยท about 20 min

By the end you can

  • Read an error message: its last line, and the kind of error it names
  • Fix a SyntaxError caused by a missing bracket
  • Fix a TypeError caused by adding text and a number
  • Check a result that has no error message: its size and its unit

Who it is for: Anyone who has done lessons 1.1 to 1.6.

The steps

  1. A first guess
  2. SyntaxError: Python can't read the line
  3. Reading a SyntaxError
  4. Fix the bracket
  5. TypeError: text and a number
  6. A number in quotation marks
  7. Which line gives a TypeError?
  8. Fix the TypeError
  9. The bug with no message
  10. No error, wrong answer
  11. Find the silent bug
  12. In your own words

Discussion 0 comments

Log in to join the discussion.

× Enlarged view