Compare commits

...

3 Commits

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,30 +40,34 @@ while True:
print("Your cigarettes cost $" + format(cost/20, '.2f'), "each") print("Your cigarettes cost $" + format(cost/20, '.2f'), "each")
cigsPerPacks = math.ceil(20 * packs)
costPerPacks = cost * packs
YEAR=365
WEEK=7
print() print()
print("You smoke: ") print("You smoke: ")
print(math.ceil(20 * packs), "per day") print(cigsPerPacks, "per day")
print(math.ceil(20 * packs * 7), "per week") print(cigsPerPacks * WEEK, "per week")
print(math.ceil((20 * packs * 365)/12), "per month") print(math.ceil((cigsPerPacks * YEAR)/12), "per month")
print(math.ceil(20 * packs * 365), "per year") print(cigsPerPacks * YEAR, "per year")
print() print()
print("This costs you: ") print("This costs you: ")
tempCost = format(cost * packs, '.2f') tempCost = format(costPerPacks, '.2f')
tempHours = calcHours(tempCost) tempHours = calcHours(tempCost)
print("$" + tempCost, "and", tempHours, "hours per day") print("$" + tempCost, "and", tempHours, "hours per day")
tempCost = format(cost * packs * 7, '.2f') tempCost = format(costPerPacks * WEEK, '.2f')
tempHours = calcHours(tempCost) tempHours = calcHours(tempCost)
print("$" + tempCost, "and", tempHours, "hours per week") print("$" + tempCost, "and", tempHours, "hours per week")
tempCost = format((cost * packs * 365)/12, '.2f') tempCost = format((costPerPacks * YEAR)/12, '.2f')
tempHours = calcHours(tempCost) tempHours = calcHours(tempCost)
print("$" + tempCost, "and", tempHours, "hours per month") print("$" + tempCost, "and", tempHours, "hours per month")
tempCost = format(cost * packs * 365, '.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")