I am new to coding, and I am trying to understand why I am getting this error. It's some sort of spacing error, and I've been working on this for quite a while now. Any insight would be appreciated. I've also inserted my error on codio.
Actual Output:
What would you like to do?
How much would you like to withdraw today? Withdraw amount was $100.00, your current balance is $400.25
Thank you for banking with us.
Expected Output:
What would you like to do?
How much would you like to withdraw today?
Withdrawal amount was $100.00, current balance is $400.25
Actual Output:
What would you like to do?
How much would you like to withdraw today? $700.00 is greater that your account balance of $500.25
Thank you for banking with us.
Expected Output:
What would you like to do?
How much would you like to withdraw today?
$700.00 is greater than your account balance of $500.25

import sys
#account balance
account_balance = float(500.25)
#<--------functions go here-------------------->
#printbalance function
def balance():
print("Your current balance: $%.2f" % account_balance)
#deposit function
def deposit():
deposit_amount = float(input("How much would you like to deposit? "))
balance = account_balance - deposit_amount
print("Deposit amount was $%.2f, current balance is $%.2f" % (deposit_amount, balance))
#withdraw function
def withdraw():
withdraw_amount = float(input("How much would you like to withdraw today? "))
if withdraw_amount > account_balance:
print("$%.2f is greater that your account balance of $%.2f" % (withdraw_amount, account_balance))
else:
balance = account_balance - withdraw_amount
print("Withdraw amount was $%.2f, your current balance is $%.2f" % (withdraw_amount, balance))
#User Input goes here, use 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 == "B"):
balance()
elif (userchoice == "W"):
withdraw()
print("Thank you for banking with us.")
I think part of the problem is that the "Thank you for banking with us." message is not supposed to be output. Also, it seems that the tests require you to print a line break after taking input (which would normally be input by the user).