Question: The retry function tries to execute an operation that might fail, it retries the operation for a number of attempts. Currently the code will
The retry function tries to execute an operation that might fail, it retries the operation for a number of attempts. Currently the code will keep executing the function even if it succeeds. Modify the code so that it stops trying after the operation succeeded. 1- def retry(operation, attempts): for n in range(attempts): 3- if operation(): print("Attempt " + str(n) + else: succeeded") 5- print("Attempt str(n) " failed") retry(create_user, 3) 6. retry(stop service, 5) 567
Step by Step Solution
3.45 Rating (158 Votes )
There are 3 Steps involved in it
To modify the function so that it stops trying after the operation succeeds y... View full answer
Get step-by-step solutions from verified subject matter experts
