Tip Calculator
November 19, 2020•130 words
Python bootcamp #100DaysOfCode #myNotes
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