Python Pushups
These are a quick exercise to kick you off with Python.
Explore Errors
Create a new directory in your working dir for the class:
$ mkdir pushups $ cd pushups
Add a new file to it called
break_me.py
In the
break_me.py
file write four simple Python functions:Each function, when called, should cause an exception to happen.
Each function should result in one of the four most common exceptions you’ll find.
For review:
NameError
TypeError
SyntaxError
AttributeError
Hint: the interpreter will quit when it hits a Exception so you can comment out all but the one you are testing at the moment.
Use the Python standard library reference on Built In Exceptions as a reference.