forked from logenkain/cig-cost
Clean up decimals
This commit is contained in:
parent
265b61343d
commit
1906414ef2
@ -3,6 +3,8 @@
|
|||||||
#user input number of packs
|
#user input number of packs
|
||||||
#output day, week, month year costs
|
#output day, week, month year costs
|
||||||
import os
|
import os
|
||||||
|
import math
|
||||||
|
|
||||||
cost = None
|
cost = None
|
||||||
packs = None
|
packs = None
|
||||||
|
|
||||||
@ -29,14 +31,16 @@ print("Your cigarettes cost", cost/20, "each")
|
|||||||
|
|
||||||
print()
|
print()
|
||||||
print("You smoke: ")
|
print("You smoke: ")
|
||||||
print(20 * packs, "per day")
|
print(math.ceil(20 * packs), "per day")
|
||||||
print(20 * packs * 7, "per week")
|
print(math.ceil(20 * packs * 7), "per week")
|
||||||
print((20 * packs * 365)/12, "per month")
|
print(math.ceil((20 * packs * 365)/12), "per month")
|
||||||
print(20 * packs * 8 * 365, "per year")
|
print(math.ceil(20 * packs * 8 * 365), "per year")
|
||||||
print()
|
|
||||||
print("This costs you: ")
|
print()
|
||||||
print(cost * packs, "Per day")
|
|
||||||
print(cost * packs * 7, "per week")
|
print("This costs you: ")
|
||||||
print((cost * packs * 365)/12, "per month")
|
print(format(cost * packs, '.2f'), "Per day")
|
||||||
print(cost * packs * 365, "per year")
|
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")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user