Bank teller project

#prints balance of both accounts def check_balance(account_type, checking_balance, savings_balance): if account_type == "savings": balance = savings_balance elif account_type == "checking": balance = checking_balance else: balance_statement = "Unsuccessful, please enter \"checking\" or \"saving\"" if account_type == "savings" or account_type == "checking": balance_statement = "Your " + account_type + " account balance is " + str( balance) return balance_statement #making a deposit def make_deposit(account_type, amount, checking_balance, savings_balance): deposit_status = [] if amount > 0: if account_type == "savings": deposit_status = "succesful" savings_balance += amount elif account_type == "checking": deposit_status = "succesful" checking_balance += amount else: deposit_status = "unsuccessful, please enter an amount greater than 0" else: deposit_status = "unsuccessful, please enter an amount greater than 0" deposit_statement = "Deposit of " + str( amount) + " to your " + account_type + " account was " + deposit_status print(deposit_statement) return savings_balance, checking_balance def make_withdrawal(account_type, amount, checking_balance, savings_balance): withdrawal_status = [] if account_type == "savings": if savings_balance >= amount: withdrawal_status = "succesful" savings_balance -= amount else: withdrawal_status = "unsuccessful, insufficient funds" elif account_type == "checking": if checking_balance >= amount: withdrawal_status = "succesful" checking_balance += amount else: withdrawal_status = "unsuccessful, insufficient funds" else: withdrawal_status = "unsuccessful, please enter \"checking\" or \"saving\"" withdrawal_statement = "Withdrawal of " + str( amount ) + " to your " + account_type + " account was " + withdrawal_status print(withdrawal_statement) return savings_balance, checking_balance def acc_transfer(acc_from, acc_to, amount, checking_balance, savings_balance): transaction_status = [] trans_error = "unsuccessful, please enter amount less than " if acc_from == "checking" and acc_to == "savings": if checking_balance >= amount: checking_balance -= amount savings_balance += amount transaction_status = "successful" else: transaction_status = trans_error + str(checking_balance) elif acc_from == "savings" and acc_to == "checking": if savings_balance >= amount: checking_balance += amount savings_balance -= amount transaction_status = "successful" else: transaction_status = trans_error + str(savings_balance) else: transaction_status = "unsuccessful, please enter \"checking\" or \"savings\"" transaction_statement = "Transfer of " + str(amount) + " from your " + acc_from + " to your " + acc_to + " account was " + transaction_status print(transaction_statement) return savings_balance, checking_balance checking_balance = 6 savings_balance = 18 savings_balance, checking_balance = make_deposit("checking", 1500, checking_balance, savings_balance) print(check_balance("checking", checking_balance, savings_balance)) savings_balance, checking_balance = make_deposit("savings", 278, checking_balance, savings_balance) print(check_balance("savings", checking_balance, savings_balance)) savings_balance, checking_balance = make_withdrawal("checking", 200, checking_balance, savings_balance) print(check_balance("checking", checking_balance, savings_balance)) print(check_balance("savings", checking_balance, savings_balance)) savings_balance, checking_balance = acc_transfer("checking", "savings", 500, checking_balance, savings_balance) print(check_balance("checking", checking_balance, savings_balance)) print(check_balance("savings", checking_balance, savings_balance))
1 Like