Skip to content

Commit a6ad061

Browse files
committed
Tip Calculator Complete
1 parent 047c63c commit a6ad061

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tipcal.py

+25
Original file line numberDiff line numberDiff line change
@@ -1 +1,26 @@
1+
# TIP CALCULATOR
2+
# If the bill $150.00, split between 5 people, with 12% tip. Round the result to 2 decimal places.
3+
# Equation = (bill / person) * tip
14

5+
# welcome message
6+
print("Welcome to the tip calculator!!")
7+
8+
# takeing user input value
9+
bill = float(input("What was the total bill? \n $"))
10+
11+
# Tip percentage message
12+
tip = int(
13+
input("What percentage tip would you like to give? [10,12 or 15 %] \n %"))
14+
15+
# how many people
16+
people = int(input("How many people to split the bill? \n"))
17+
18+
# tip calculation
19+
tip_as_percentage = tip / 100
20+
total_tip_amount = bill * tip_as_percentage
21+
total_bill = bill + total_tip_amount
22+
bill_per_person = total_bill / people
23+
24+
final_amount = round(bill_per_person, 2)
25+
26+
print(f"Each person should pay: ${final_amount}")

0 commit comments

Comments
 (0)