# [Tutor] [maryknauth at mac.com: Re: Input parameters for functions]

Mary Knauth maryknauth at mac.com
Sat Jun 20 13:22:43 EDT 2020

```Thanks everyone for the good information!

I’ve updated the functions to reflect return account_balance, but when I run other transactions the balance still defaults to original \$500.25

I realize this isn’t the best exercise, the course only wanted us to define the functions and then use them, it did not include a loop or return.  Just trying to figure out for my own curiosity.

def balance(account_balance):                                                   # Define balance function
print("Your current balance is \$%.2f" % (account_balance))                    # Prints the current avalible balance

def deposit(account_balance, deposit_amount):                                   # Define DEPOSIT function with parameters account_balance and deposit_amount
deposit_amount = float(input("How much would you like to deposit today?\n"))  # Accept user input for the deposit amount, in float format
account_balance += deposit_amount                                             # This addition assigns the updated value of the account blance, to the variable 'account_balance'
print("Deposit was \$%.2f , your new current balance is \$%.2f" % (deposit_amount, account_balance))  # Prints depost amount and account balance
return account_balance                                                        # Return records the new value of account_balance to reflect accordingly in other transactions

def withdrawal(account_balance, withdrawal_amount):                             # Define WITHDRAWAL function with parameters account_balance and withdrawal_amount
withdrawal_amount = float(input("How much would you like to withdraw today?\n")) #  Accept user input for the withdrawal amount, in float format
if withdrawal_amount > account_balance:                                       # Checking to see if the amount requested, is greater than the amount avalible
print("Insuffient funds, \$%.2f is greater than your account balance of \$%.2f" % (withdrawal_amount, account_balance)) # If the amount requested is greater than the account balance, there are insuffient funds
else:                                                                         # Suffient amount of funds are avalible, the function continues
account_balance -= withdrawal_amount                                        # Variable 'account_balance' is assigned to reflect the new avalible balance
print ("Withdrawal amount was \$%.2f, your new current balance is \$%.2f" % (withdrawal_amount, account_balance))  # Prints withdrawal amount and account balance
return account_balance                                                      # Return records the new value of account_balance to reflect accordingly in other transactions

Warm Regards,

Mary Knauth

954-412-9280
maryknauth at mac.com
http://www.zephyrsolutions.us <http://www.zephyrsolutions.us/>

<https://zephyrsolutions.us/>

> On Jun 20, 2020, at 11:23, alexkleider <alexkleider at protonmail.com> wrote:
>
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Saturday, June 20, 2020 6:08 AM, Mary Knauth via Tutor <tutor at python.org> wrote:
>
>>
>> ‘return account_balance = account_balance + deposit_amount’ is an invalid syntax, so I need to read more about how to utilize return.
>
> Try
>    account_balance += deposit_amount
>    return account_balance
> or simply
>    return account_balance + deposit_amount
>

```