+ 1

Ballpark order code does not work with testcase 4, what did I do wrong?

This is my first try on some code practises, but i just can't write a code that succeeds all testcases, so what did i do wrong? I already tried formating. order = input() menu = ["Cheeseburger", "Pizza", "Water", "Coke", "Natcho", "Popcorn"] pricelist = 0 table= order.split(" ") x = 0 while x < len(table): if table[x] == menu[0]: pricelist = pricelist + 10 elif table[x] == menu[1]: pricelist = pricelist + 6 elif table[x] == menu[2]: pricelist= pricelist + 4 elif table[x] == menu[3]: pricelist = pricelist + 5 elif table[x] == menu[4]: pricelist = pricelist + 6 else: pricelist = pricelist + 5 x= x+1 endprice= float(pricelist * 1.07) print (round(endprice,2))

26th Jul 2024, 8:52 AM
Vanessa Holtei
Vanessa Holtei - avatar
4 odpowiedzi
+ 5
It is "Nachos", not "Natcho"
26th Jul 2024, 10:03 AM
Lisa
Lisa - avatar
+ 1
Yep, everything running now, thanks, even tho it was just a typo.
29th Jul 2024, 3:41 AM
Vanessa Holtei
Vanessa Holtei - avatar
0
Is it solved? Vanessa Holtei
27th Jul 2024, 4:33 PM
Harimamy Ravalohery
Harimamy Ravalohery - avatar
0
Nice!
29th Jul 2024, 4:13 AM
Harimamy Ravalohery
Harimamy Ravalohery - avatar