Write a simple ATM program. Ask the user to enter their account number, and then
ID: 3569703 • Letter: W
Question
Write a simple ATM program. Ask the user to enter their account number, and then print their beginning balance. (Just make one up). Then ask them if they want to make a deposit or a withdrawal. Depending on their selection, call a function to perform the action that they wish. Then print the new balance. They should be able to do as many transactions as they wish, so use iteration here. I am having trouble understanding how to use arguments and paramaters. Will pay BIG for whole code by 11:30 tonight!
Explanation / Answer
def getBalance(choice, balance):
if(choice== 1 or choice==2):
amount=float(input("Enter amount: "))
if(choice== 1):
balance = balance + amount
if(choice== 2):
balance = balance - amount
return balance
def bank():
balance = 100
accountNum = input("Enter account number: ")
choice= 1
print ('Balance: '),balance
while (choice== 1 or choice==2):
#ask for deposit or a withdrawal or exit
choice =float(input("Enter 1 for Deposit, 2 for Withdrawl, 3 to Exit: "))
balance = getBalance(choice, balance)
#print total amount
print ('Balance: '),balance
def main():
bank()
main()
Read more: http://www.justanswer.com/computer-programming/8i5yv-python-programming-write-simple-atm-program-ask-user.html#ixzz3LH0J3XaS
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.