+ 1
What do i need to add
Ball park question https://code.sololearn.com/cjUNh5mpAzC8/?ref=app
4 Answers
+ 1
You are testing the entire array in your if statement instead of the current element. Use i not y.
0
Maybe you are supposed to only print the tax and not tax + price?
What exactly is the task?
0
Firstly you should put the value "sum=0" outside of the for loop because while inside the for loop the sum is always reset. Also use i instead of y as John Wells said. So here is the code:
x = input()
y = x.split(" ")
sum=0
for i in y:
if "Pizza" in i:
sum += 6
elif "Nachos" in i:
sum += 6
elif "Cheeseburger" in i:
sum += 10
elif "Water" in i:
sum += 4
else:
sum += 5
tax = (sum*107)/100
print(tax)
0
Thank you very much guys