diff --git a/cost-of-smokes.py b/cost-of-smokes.py index 83664a7..135f302 100644 --- a/cost-of-smokes.py +++ b/cost-of-smokes.py @@ -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")