I tried to write a code that calculates the amount of bill everyone should pay after adding the tip but I wanted to limit the user to certain tip percentages and give them an error if they picked something else.
So, I came up with this:
print("Welcome to the tip calculator.")
bill = float(input("What was the total bill?"))
people = int(input("How many people to split the bill?"))
perc = int(input("What percentage tip would you like to give? 10, 12, or 15?"))
total = float((bill + (bill * perc / 100)) / people)
while perc != 10 or perc != 12 or perc != 15:
print("Error, please chose one of the given percentages.")
perc = float(input("What percentage tip would you like to give? 10, 12, or 15?"))
else:
print("Everyone should pay", total)
But, even though I enter 10, 12, or 15 I get the " Error, please chose one of the given percentages." message. What should I do?