Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

account balance

I am a bit confused by this can someone explain what this means “As stated in the announcement for this week, global variables should not be used in this project. Information for the function needs to be passed through the argument list and any value returned to the main program has to be through a return  statement.”

this is my script and it worked but i guess i did something wrong??

import sys

#defines account balance 

account_balance = float(500.25)

#defines balance function and prints

def balance():

 print(“Your current balance:n %.2f” % account_balance)

#defines deposit function

def deposit():

#asks user for deposit amt input

 deposit_amount = float(input(“How much would you like to deposit today?n “))

 balance = account_balance + deposit_amount

#prints amt of deposit and acct balance

 print(“Deposit was $%.2f, current balance is $%.2f” % (deposit_amount, balance))

#defines withdraw function

def withdraw():

#asks user for input of withdraw amt 

 withdraw_amount = float(input(“How much would you like to withdraw today?n “))

#verify the withdraw_amount is greater than the account_balance

 if withdraw_amount > account_balance:

  print(“$%.2f is greater than your account balance of $%.2f” % (withdraw_amount, account_balance))

#Calculate the account_balance and display the withdraw_amount,and print the account balance with the ‘$’ and with two decimal points

 else:

  balance = account_balance – withdraw_amount

  print(“Withdrawal amount was $%.2f, current balance is $%.2f” % (withdraw_amount, balance))

#asks for input from user for choice of Withdrawal, Deposit, or Balance

#if/else conditional statement to call function based on user input

userchoice = input (“What would you like to do?n”)

if (userchoice == “D”):

 deposit()

elif (userchoice == “W”):

 withdraw()

elif (userchoice == “B”):

 balance()

else:

 print(“Thank you for banking with us.”)

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"