Created
December 26, 2020 16:25
-
-
Save MrThiago/988223aede62b824c67136b35c28c13a to your computer and use it in GitHub Desktop.
Tip and Bill split Calculator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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