Clean up decimals

This commit is contained in:
Logen Kain 2020-08-17 12:57:36 -04:00
parent 265b61343d
commit 1906414ef2

View File

@ -3,6 +3,8 @@
#user input number of packs
#output day, week, month year costs
import os
import math
cost = None
packs = None
@ -29,14 +31,16 @@ print("Your cigarettes cost", cost/20, "each")
print()
print("You smoke: ")
print(20 * packs, "per day")
print(20 * packs * 7, "per week")
print((20 * packs * 365)/12, "per month")
print(20 * packs * 8 * 365, "per year")
print()
print("This costs you: ")
print(cost * packs, "Per day")
print(cost * packs * 7, "per week")
print((cost * packs * 365)/12, "per month")
print(cost * packs * 365, "per year")
print(math.ceil(20 * packs), "per day")
print(math.ceil(20 * packs * 7), "per week")
print(math.ceil((20 * packs * 365)/12), "per month")
print(math.ceil(20 * packs * 8 * 365), "per year")
print()
print("This costs you: ")
print(format(cost * packs, '.2f'), "Per day")
print(format(cost * packs * 7, '.2f'), "per week")
print(format((cost * packs * 365)/12, '.2f'), "per month")
print(format(cost * packs * 365, '.2f'), "per year")