Question: ALL IN PYTHON Problem 8 Write a function called take amount that prompts the user to enter an amount (from the console) and verify that

ALL IN PYTHON

ALL IN PYTHON Problem 8 Write a function called take amount that

Problem 8 Write a function called take amount that prompts the user to enter an amount (from the console) and verify that the amount is a positive integer that is a multiple of 20 The function returns the amount entered if it is a valid amount. If the amount is invalid, the function should print INVALID" and ask for another input. The function should impose a maximum of 3 attempts to input a valid value. If the user fails to enter a valid value after 3 attempts, the function should raise an exception called InvalidAmountError (assume it is already defined) Example runs (bolded, italic txt indicates input, normal text indicates output): Amount: -5 INVALID Amount: 20.0 INVALID Amount: 6 Amount: -5 INVALID Amount: 26.0 INVALID Amount: 15 INVALID Traceback (most recent call Last). InvalidAmountError wouLd be raised def take amount() -> int

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 Databases Questions!