In [ ]:
print "5" + 5
In the example above, we had an error in our code and Python printed an error message. The format of these messages will vary depending on how you're running your code (in a notebook, in a script, or in the interpreter), but there will usually be a few key pieces of useful information contained in the message that will hint at what the problem was:
---->
(if there were more than one line of code here, this would be more informative!). TypeError
.cannot concatenate 'str' and 'int' objects
"). A good place to start in fixing an error is to go to the problematic line of code and see if you can spot anything wrong, especially involving whatever is hinted at in the message. If that fails, and you really don't understand what the error means, try googling "python [NameOfErrorType]" (e.g. "python TypeError"). This will usually pull up several forums with people who had the same general type of error. When reading through these forums, don't focus too much on the specifics of the problem (it will never been the exact same situation as you) but rather try to look for types of things that can cause the error and how to fix them.