Question: I keep getting an error for this ATM script. Anyone have any ideas as to what is wrong?? import sys #account balance account_balance = float(500.25)
I keep getting an error for this ATM script. Anyone have any ideas as to what is wrong??
import sys
#account balance account_balance = float(500.25)
# #printbalance function def balance(): print("Your current balance: $%.2f" % account_balance)
#deposit function def deposit(): deposit_amount = float(input("How much would you like to deposit? ")) balance = account_balance + deposit_amount print("Deposit amount was $%.2f, current balance is $%.2f" % (deposit_amount, balance))
#withdraw function def withdraw(): withdraw_amount = float(input("How much would you like to withdraw? ")) if withdraw_amount > account_balance: print("$%.2f is greater that your account balance of $%.2f" % (withdraw_amount, account_balance)) else: balance = account_balance - withdraw_amount print("Withdrawal amount was $%.2f, your current balance is $%.2f" % (withdraw_amount, balance))
#User Input goes here, use if/else conditional statement to call function based on user input userchoice = input("What would you like to do? ")
if (userchoice == "D"): deposit() elif (userchoice == "W"): withdraw() elif (userchoice == "B"): balance()
print("Thank you for banking with us.")

inport sys account balance account balance float(500.25) Collect Customer Input tunctions go here The following data will be used as input in the test: printba1ance function def halance): print("Your current balance: $%.2f" ? account-balance? userchoice inout ("what would yu like to do) userchoice B tdeposit function 12 13def depos1t) 14 deposit amount-float inut("How much would you like to deposit?")) balanceaccount balace depositanount print("Deposit amount was $$.2f, current balance 1s $%.2f" (deposit-amount, balance)) Output Information 16 17 19 19def withdraw( 20 21- withdraw function Your curent balance: 538.25 withdraw amountfloat input("How much would ycu like to withdraw? ")) if withdr aw anount acccunt balance: is print("$$, 2f greater that your account balance of $$.2f" (wthdraw-anount, account-balance)) 23 24 25 26 27 28 userchoicenput("What would you like to do?n") 29 Collect Customer Input Check balanceaccount balanceithdrawanount print("withdrawa amount was $%.2f, your current balance ?s $$. 2 f" % (withdraw-amount, balance)) User Input goes here, use iffelse conditional statement to call funetion based on user input deposit) withdraw balance() LAST FOLN un 4712018, 122828 Check 1 falled Outputi Wbat wwald you like to do? Your current baluncei $500.25 bank you for banking with us 31 32elif (userchaice: 34elif (userchoice"B) 35 36 37 print("Thank you for banking with us.") Wbat wald you like to do? Your current balance 500.25
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
