Ch 3 Debugging Flashcards
good practices
Start small. Get something working and keep it working
Use print statements to debug lines of code. Rubber duck debugging (explain, out loud, what each line of your code does to an inanimate object).
NameError
Usually means that a variable has not been assigned a value yet. That is, you have used a variable before a value has been assigned to it
ParseError
Errors in the syntax of the program, so the interpreter cannot parse the python code. Such as “ print ‘this’ “ would result in a syntax error, the error being that the print function needs to have a proper header build, like this: print( ) . The string to be printed, “this”, should be inserted between the parentheses in the print() function, like this: print(“this”).
ValueError
Errors that occur when a function is expecting certain limitations on the values of its parameters and receives something outside of those limitations.