Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started