day 2
This commit is contained in:
13
002/task.py
Normal file
13
002/task.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
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}")
|
||||||
Reference in New Issue
Block a user