B.18 Common Error Messages
Learning how to read and understand error messages can save a lot of time and trouble once you know what to look for.
One of the most common errors is the syntax error, which indicates that you have written a line of code that does not follow the rules of Python’s grammar. Here is an example of a syntax error that is due to a missing colon (:) at the end of the function definition line def foo(x, y). It is also very common to get a syntax error like this when you are using an if statement.
Another common error is to use a variable that has not yet been assigned a value. The following example shows an attempt ...
Get Python Programming in Context, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.