+ 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))
4 Answers
+ 5
It is "Nachos", not "Natcho"
+ 1
Yep, everything running now, thanks, even tho it was just a typo.
0
Is it solved? Vanessa Holtei
0
Nice!