Created
April 13, 2017 14:45
-
-
Save brockthebear/9c736e6f90a826bc49b7fd2d827861e8 to your computer and use it in GitHub Desktop.
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
import sys | |
def get_total_cost_of_meal(): | |
# original meal price | |
meal_cost = float(sys.stdin.readline()) | |
# tip percentage | |
tip_percent = int(sys.stdin.readline()) | |
# tax percentage | |
tax_percent = int(sys.stdin.readline()) | |
# Write your calculation code here | |
# calculate tip | |
tip = meal_cost * (tip_percent / 100) | |
# caclulate tax | |
tax = meal_cost * (tax_percent / 100) | |
# cast the result of the rounding operation to an int and save it as total_cost | |
total_cost = int(round(meal_cost + tip + tax)) | |
return str(total_cost) | |
# Print your result | |
print("The total meal cost is " + get_total_cost_of_meal() + " dollars.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment