Question: def break_modules(x,y): return x/y print(break_modules(5,2)) print(break_modules(7,0)) print(break_modules(7,ten)) You have been asked to use a Python try:except block to modify thefunction given to you to handle

def break_modules(x,y):
return x/y

print(break_modules(5,2))
print(break_modules(7,0))
print(break_modules(7,’ten’))


You have been asked to use a Python try:except block to modify thefunction given to you to handle one specific error in a gracefulmanner. When a division by zero error occurs, your new functionshould return a message that says, “All numbers must be greaterthan zero’. For all other errors, your new function should return amessage that states, “Unknown error, please check yournumbers”.

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!