Question: python pls Suppose we're writing a program for an ATM, that handles actions such as bank account withdrawals (removing funds from a bank account). We

 python pls Suppose we're writing a program for an ATM, that

python pls

Suppose we're writing a program for an ATM, that handles actions such as bank account withdrawals (removing funds from a bank account). We define a namedtuple representing a bank account below: Account = namedtuple('Account', 'id balance') The id attribute is an integer, and the balance attribute is a float. Write the function make_withdrawal, which takes as an argument an Account object, representing a customer's bank account. The function should prompt the user (taking input from the shell) for an amount of money to withdraw from the bank account - with a valid amount satisfying these conditions: the amount must be a positive integer that is a multiple of 20. the amount cannot be greater than the current balance of the bank account (i.e. you can't withdraw more funds than is available in the account). The function should prompt the user repeatedly until a valid amount is entered, and return a modified version of the Account object, with the new remaining balance after withdrawal. If the function receives an empty input (e.g. user types nothing and presses Enter), then the function should end and return the given account object unchanged. Examples (Bolded, italic text indicates user input, normal text indicates output) # make_withdrawal (Account (123, 95.50)) Amount: -5 INVALID Amount: 20.0 INVALID Amount: 40 # returns Account(123, 55.50) # make_withdrawal (Account(456, 150.00)) Amount: 175 INVALID Amount: 150.01 INVALID Amount: # returns Account(456, 150.00) def make_withdrawal(account: Account) -> Account

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!