Name Error In Python 3

Traceback most recent call last.
Name error in python 3. Look at the following example. It is possible to write programs that handle selected exceptions. It is feasible to program selected exceptions through programming. It will always require user input until enter a valid integer but allows the user to interrupt the program using control c or any method supported by the system.
Look at the following example which asks the user for input until a valid integer has been entered but allows the user to interrupt the program using control c or whatever the operating system supports. Name print books is not defined we are trying to call print books on line three. Name is not defined python 3 we need to make sure that the variable name is spelled correctly. Python variables know the kinds of values they hold which allows python to tell you when you re trying to do something strange such as use the addition operator to combine a number and a string answer hello 1.
A user generated interrupt will raise a keyboard interrupt exception. An expression is tested and if the result comes up false an exception is raised. You forgot to put quotes around a string so python thinks it s a variable you misspelled a function name such as pring instead of print you used a variable without first having assigned a value to it. Note that a user generated interruption is signalled by raising the keyboardinterrupt exception.
File main py line 3 in module print books books nameerror. The easiest way to think of an assertion is to liken it to a raise if statement or to be more accurate a raise if not statement. However we do not define this function until later in our program.