Created
December 6, 2017 07:06
-
-
Save spaghettiSyntax/ffc1b395339634592e4594cdb5deb41b to your computer and use it in GitHub Desktop.
Tony Gaddis Python: Tip, Tax, Food
This file contains 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
# Tip, Tax Food Calculator | |
# First Flowchart problem homework 1 | |
# We will use 18% as the tip rate | |
TIP_PERCENTAGE = 0.18 | |
# Currently the tax rate is 9% | |
TAX_PERCENTAGE = 0.09 | |
charge_for_food = float(input('Input charge for food: ')) | |
tip = TIP_PERCENTAGE * charge_for_food | |
tax = TAX_PERCENTAGE * charge_for_food | |
total = charge_for_food + tip + tax | |
# + tip + tax works and is a LOGIC error, will still run without syntax issues. | |
#Leaving off the f on .2f will make numbers go into exponential notation | |
print('Charge for food: $', format(charge_for_food, ',.2f'), sep = '') | |
print('Tip: $', format(tip, ',.2f'), sep = '') | |
print('Tax: $', format(tax, ',.2f'), sep = '') | |
print('Total: $', format(total, ',.2f'), sep = '') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment