Python Tip Calculator
#If the bill was $150.00, split between 5 people, with 12% tip.
#Each person should pay (150.00 / 5) * 1.12 = 33.6
#Round the result to 2 decimal places.
print("Welcome to the tip calculator!")
bill = float(input("What was the total bill? $"))
tip = int(input("How much tip would you like to give? 10, 12, or 15? "))
people = int(input("How many people to split the bill?"))
tip_as_percent = tip / 100
total_tip_amount = bill * tip_as_percent
total_bill = bill + total_tip_amount
bill_per_person = total_bill / people
final_amount = round(bill_per_person, 2)
print(f"Each person should pay: ${final_amount}")
This code is a simple program for calculating the amount of tip and the total bill for a group of people. The program first prints a welcome message, then prompts the user for three pieces of information: the total bill, the desired tip percentage, and the number of people splitting the bill. The tip percentage is entered as an integer (10, 12, or 15) and is then converted to a decimal by dividing by 100. The total tip amount is calculated by multiplying the bill by the tip percentage. The total bill is then calculated by adding the tip amount to the original bill. The final amount each person should pay is calculated by dividing the total bill by the number of people, and then rounding the result to two decimal places. Finally, the program prints the final amount each person should pay.