13 lines
365 B
Python
13 lines
365 B
Python
print("Welcome to the tip calculator!")
|
|
|
|
bill = input("What was the total bill? $")
|
|
|
|
tip = ""
|
|
while tip not in ["10", "12", "15"]:
|
|
tip = input("How much tip would you like to give? 10, 12 or 15? ")
|
|
|
|
people_nb = input("How many people to split the bill? ")
|
|
|
|
share = (1+(int(tip)/100)) * float(bill) / int(people_nb)
|
|
|
|
print(f"Each person should pay ${share:.2f}") |