2

So my code kinda correct when seeing all the steps neccesary for the code to run and output but when checking i got Error for input of EOF halts program

this is my code

d = {
    "Baja Taco": 4.00,
    "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
}
food_total = 0.00
while True:
    x = input("Item: ").title()
    if x in d:
        food_total += d[x]
        print("Total: $", food_total, sep="")
    else:
        print(end="")

I even tried to change the code to

d = {
    "Baja Taco": 4.00,
    "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
}
food_total = 0.00
while True:
    try:
        x = input("Item: ").title()
        if x in d:
            food_total += d[x]
            print("Total: $", food_total, sep="")
        else:
            print(end="")
    except EOFError:
        pass

but no difference is made

Bill Hileman
  • 2,798
  • 2
  • 17
  • 24

0 Answers0