Lesson 9. Simple error messages

 

After reading lesson 9, you’ll be able to

  • Understand where error messages appear
  • Develop your intuition for reading error messages

One important thing to remember as you’re starting to program is that you can’t write a program that will break your computer. If anything goes wrong, you can always close Spyder and restart it without affecting how anything else on your computer runs.

It’s fine to make mistakes as you’re writing and testing your programs. Any mistakes left in the production environment may mean that your program crashes while being used by customers, leading to poor reviews.

9.1. Typing up statements and trying things out

You shouldn’t be afraid of trying commands in Spyder (the console or the file editor) to see what happens. This is the best way to develop your intuition for working with objects that you’ve seen so far. If you ever find yourself asking, “What happens if ...?”, most likely you can test it out for yourself and get an answer immediately.

9.2. Understanding string error messages

So far, you’ve seen some simple operations that you can do on Python strings. I hope that you’ve been trying things out in Spyder. If you have, you may have tried to do something that’s not allowed, in which case you got an error message.

Summary

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage