#๐Ÿ”’ Python assignment need help bc autograder

10 messages ยท Page 1 of 1 (latest)

fringe pewter
#

I keep getting this error code when submittting my work by the auto grader and I want help before I contact my prof. My assignment is to represent an online bank application.

======================================================================
Your output: $816.60
Expected : $816.6

while True:
    print('\nMenu')
    print("0 โ€“ Make a deposit")
    print("1 โ€“ Make a withdrawal")
    print("2 โ€“ Display account value")
    print('')


    choice = input("Please make a selection: ")


    if choice == "0":
        amount = float(input("How much would you like to deposit?: "))
        if amount > 0:
            balance += amount
            print(f"Your current balance is ${balance:.2f}")


    elif choice == "1":
        amount = float(input("How much would you like to withdraw?: "))
        if 0 < amount <= balance:
            balance -= amount
            print(f"Your current balance is ${balance:.2f}")

        else:
            print("Not enough balance. Withdrawal cancelled.")



    elif choice == "2":
        print(f"Your current balance is {balance:.2f}")


    else:
        print("Invalid entry, please try again.")

    back_to_menu = input("Would you like to return to the main menu (Y/N)?: ").upper()
    if back_to_menu != "Y":
        print("Thank you for banking with us!")
        break
grizzled rainBOT
#

@fringe pewter

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

narrow bronze
#

round it or turn it into a string and take off the last 0

thorny ocean
#

since your format is actually the expected one, definitely contact your professor

fringe pewter
#

I got it, just had to change

{balance:.2f}

to

{balance:.1f}
narrow bronze
fringe pewter
narrow bronze
#

or you could just make your own rounding by removing the second zero as i suggested earliest

grizzled rainBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.