Question: im trying to identify the error but im not able to figure it out In this activity, we will practice handling errors. The code in
im trying to identify the error but im not able to figure it out
In this activity, we will practice handling errors. The code inSnippet 9.53throws an error.
The following code throws an error:
importrandom
print(random.randinteger(5,15))
Identify and handle the error so that when it occurs, the message is printed to the terminal.
Steps for Completion
- Go to yourmain.pyfile.
- Take the code block fromSnippet 9.53, and amend to it so that it catches the error, using atry... exceptblock.
- Within thetry... exceptblock make the exception look for anAttriubuteErrorand printDouble check the attributes in your code and try again.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
