Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- account_balance = float(500.25)
- deposit_amount = float(0)
- withdraw_amount = float(0)
- def printbalance(account_balance):
- balance = account_balance
- return account_balance
- def deposit (deposit_amount, account_balance):
- deposit_amount = float(input('How much would you like to deposit today?'))
- account_balance = account_balance + deposit_amount
- print ('Deposit was $' + '%.2f' % deposit_amount +', current balance is $' + '%.2f' % account_balance)
- return deposit_amount, account_balance
- def withdraw (withdraw_amount, account_balance):
- withdraw_amount = float(input('How much would you like to withdraw today?'))
- if withdraw_amount > account_balance:
- print ('$' + '%.2f' % withdraw_amount + 'is greater than your account balance of $' + '%.2f' % account_balance)
- elif withdraw_amount <= account_balance:
- account_balance = account_balance-withdraw_amount
- print('Withdrawal amount was $' + '%.2f' % withdraw_amount + ', current balance is $' + '%.2f' % account_balance)
- return withdraw_amount, account_balance
- userchoice = ('M')
- while userchoice != 'Q':
- userchoice = input ("What would you like to do?\nEnter B for Balance, D for Deposit, or W to Withdraw. Select Q to Quit")
- if (userchoice == 'B'):
- print ('your current balance:')
- print(printbalance(account_balance))
- elif (userchoice == 'D'):
- deposit(deposit_amount, account_balance)
- elif (userchoice == 'W'):
- withdraw(withdraw_amount, account_balance)
- elif (userchoice == 'Q'):
- print ('Thank you for banking with us.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement