Tip Calculator

Day 2 - Python bootcamp #100DaysOfCode

I have learned about Data Types, Type errors, Type conversion and mathematical operations in Python.
The end project was to build a Tip Calculator.

#begin code
print("Welcome to the tip calculator.")

total = float(input("What was the total bill? $") )
percentage = int(input("What percentage tip would you like to give? 10, 12 or 15? ") )
people = int(input("How many people to split the bill? ") )
amount_per_person = (total / people) * (percentage/100 +1)

print(f"Each person should pay: ${amount_per_person:.2f}")
#end code

The program looks like this:

Welcome to the tip calculator.
What was the total bill? $150.00
What percentage tip would you like to give? 10, 12 or 15? 12
How many people to split the bill? 5
Each person should pay: $33.60


You'll only receive email when Luus publishes a new post

More fromĀ Luus