Skip to content

Instantly share code, notes, and snippets.

@MrThiago
Created December 26, 2020 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrThiago/988223aede62b824c67136b35c28c13a to your computer and use it in GitHub Desktop.
Save MrThiago/988223aede62b824c67136b35c28c13a to your computer and use it in GitHub Desktop.
Tip and Bill split Calculator
print("Tip and Bill Calculator")
bill = float(input("What is the total bill?\n"))
tip = int(input("What percentage tip would you like to give: 10, 12, 15 or 20?\n"))
people = int(input("How many people to split the bill?\n"))
# Get the percentage
tip_percentage = tip / 100
# The the tip amount
total_tip_amount = bill * tip_percentage
# Add the Tip tp the bill
total_bill = bill + total_tip_amount
cost_per_person = round(total_bill / people, 2)
# Formate the final amount to 2 decimal places
cost_per_person_formated = "{:.2f}".format(cost_per_person)
print(f"The cost per person is {cost_per_person_formated}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment