Enter a python error message, and the example code that caused that error.
Created
September 23, 2016 13:43
-
-
Save airportyh/6a55675f52df04e6c3b24d7ba530a2f4 to your computer and use it in GitHub Desktop.
Catalog of Python Errors
week = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
day_of_week = int(raw_input("Please give a day of week (0-6) 0 is Sunday. "))
print "It is %s." % week[day_of_week]produces this error when an invalid day of the week is entered
python errortest.py
Please give a day of week (0-6) 0 is Sunday. 7
Traceback (most recent call last):
File "errortest.py", line 4, in <module>
print "It is %s." % week[day_of_week]
IndexError: list index out of range
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Gets this error: