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

  1. Go to yourmain.pyfile.
  2. Take the code block fromSnippet 9.53, and amend to it so that it catches the error, using atry... exceptblock.
  3. 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!