u/DiegoPiego

▲ 2 r/cs50

CS50P Problem 3.2: Felipe's Taquiera - Can't print total

I'm supposed to print Total: $order_price after each item. Problem is my print doesn't go off. My output to the terminal is just "Item:" in loop

Is there a mistake with my use of try and except?

Also I can't seem to break with control-d

def main():
    menu={
        "Baja Taco": 4.25,
        "Burrito": 7.50,
        "Bowl": 8.50,
        "Nachos": 11.00,
        "Quesadilla": 8.50,
        "Super Burrito": 8.50,
        "Super Quesadilla": 9.50,
        "Taco": 3.00,
        "Tortilla Salad": 8.00
    }
    total=0.00
    while True:
        try:
            item=input("Item: ").title().strip()
            if item in menu:
                total+=menu[item]
                print(f"Total: ${total}")
        except ValueError: break
        except EOFError: break

if __name__ == "__main__":
    main()
reddit.com
u/DiegoPiego — 6 days ago