my wife and I are having troubles completing this challenge for a python course we are doing online.
The instructor says to get the result to 2 decimal spaces and when we watch the video she uses:
Example: print(round(8 / 3, 2) = 2.66
For our coding challenge we can't figure it out. This is the code in the coding challenge that we got so far. We are trying to get the 33.60 result and have been trying for two days rewriting the code.
#If the bill was $150.00, split between 5 people, with 12% tip.
#Each person should pay (150.00 / 5) * 1.12 = 33.6
#Format the result to 2 decimal places = 33.60
#Tip: There are 2 ways to round a number. You might have to do some Googling to solve this.
#Write your code below this line
print("Welcome to the tip calculator.")
total_bill = input("What was the total bill? ")
tip = input("What pecentage tip would you like to give? 10, 12, or 15? ")
people = input("How many people to split the bill? ")
tip_percent = int(tip) / 100
tax_total = float(total_bill) * tip_percent
tax_and_bill = float(total_bill) + tax_total
split_cost = float(tax_and_bill) / int(people)
final_amount = round(split_cost, 2)
print(final_amount)
Tried to rewrite the code in different ways with using what we were taught, the round(8 / 3, 2) what we were taught.