Clean up print statements

This commit is contained in:
Logen Kain 2020-09-19 10:08:37 -04:00
parent cfc464a709
commit 6ebcd6b664

View File

@ -8,12 +8,10 @@ import math
cost = None cost = None
packs = None packs = None
def calcHours(tempCost): def calcHours(tempCost):
return format(float(tempCost)/wages, '.2f') return format(float(tempCost)/wages, '.2f')
while True: while True:
os.system('clear') os.system('clear')
try: try:
@ -42,17 +40,17 @@ while True:
print("Your cigarettes cost $" + format(cost/20, '.2f'), "each") print("Your cigarettes cost $" + format(cost/20, '.2f'), "each")
cigsPerPacks = 20 * packs cigsPerPacks = math.ceil(20 * packs)
costPerPacks = cost * packs costPerPacks = cost * packs
YEAR=365 YEAR=365
WEEK=7 WEEK=7
print() print()
print("You smoke: ") print("You smoke: ")
print(math.ceil(cigsPerPacks), "per day") print(cigsPerPacks, "per day")
print(math.ceil(cigsPerPacks * WEEK), "per week") print(cigsPerPacks * WEEK, "per week")
print(math.ceil((cigsPerPacks * YEAR)/12), "per month") print(math.ceil((cigsPerPacks * YEAR)/12), "per month")
print(math.ceil(cigsPerPacks * YEAR), "per year") print(cigsPerPacks * YEAR, "per year")
print() print()
@ -73,4 +71,3 @@ print("$" + tempCost, "and", tempHours, "hours per month")
tempCost = format(costPerPacks * YEAR, '.2f') tempCost = format(costPerPacks * YEAR, '.2f')
tempHours = calcHours(tempCost) tempHours = calcHours(tempCost)
print("$" + tempCost, "and", tempHours, "hours per year") print("$" + tempCost, "and", tempHours, "hours per year")