From 27a71817bc3471df95c25217f440dcd3f539b471 Mon Sep 17 00:00:00 2001 From: Tanguy Deleplanque Date: Tue, 10 Jun 2025 13:07:09 +0200 Subject: [PATCH] day 2 --- 002/task.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 002/task.py diff --git a/002/task.py b/002/task.py new file mode 100644 index 0000000..ec89b21 --- /dev/null +++ b/002/task.py @@ -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}") \ No newline at end of file