Question: I need some help with the code below and I have attempted to add the correct code but I'm getting the incorrect result. Per the

I need some help with the code below and I have attempted to add the correct code but I'm getting the incorrect result. Per the "mystery_value = 5" the code I wrote printed: 1.0

25

and the expected value should be 1.0.

#Write program that divides mystery_value by mystery_value

#and prints the result. If that operation results in an

#error, divide mystery_value by (mystery_value + 5) and then

#print the result. If that still fails, multiply mystery_value

#by 5 and print the result. You may assume one of those three

#things will work.

#

#You may not use any conditionals.

#

#Hint: You're going to want to test one try/except structure

#inside another! Think carefully about whether the second

#one should go inside the try block or the except block.

#Add your code here!

try:

print(mystery_value / mystery_value)

except:

print(mystery_value (mystery_value + 5))

else:

print(mystery_value * 5)

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!