Colorize output #2

Closed
mollusk wants to merge 1 commits from mollusk/cig-cost:master into master

View File

@ -4,6 +4,8 @@
#output day, week, month year costs #output day, week, month year costs
import os import os
import math import math
import ciglib
from ciglib import fgColor
cost = None cost = None
packs = None packs = None
@ -40,32 +42,32 @@ while True:
os.system('clear') os.system('clear')
break break
print("Your cigarettes cost $" + format(cost/20, '.2f'), "each") print(fgColor.RED,"Your cigarettes cost $" + format(cost/20, '.2f'), "each", fgColor.NC)
print() print()
print("You smoke: ") print(fgColor.CYAN,"You smoke: ",fgColor.NC)
print(math.ceil(20 * packs), "per day") print(fgColor.YELLOW,math.ceil(20 * packs), "cigarettes per day", fgColor.NC)
print(math.ceil(20 * packs * 7), "per week") print(fgColor.YELLOW,math.ceil(20 * packs * 7), "cigarettes per week",fgColor.NC)
print(math.ceil((20 * packs * 365)/12), "per month") print(fgColor.YELLOW,math.ceil((20 * packs * 365)/12), "cigarettes per month",fgColor.NC)
print(math.ceil(20 * packs * 365), "per year") print(fgColor.YELLOW,math.ceil(20 * packs * 365), "cigarettes per year", fgColor.NC)
print() print()
print("This costs you: ") print(fgColor.CYAN,"This costs you: ",fgColor.NC)
tempCost = format(cost * packs, '.2f') tempCost = format(cost * packs, '.2f')
tempHours = calcHours(tempCost) tempHours = calcHours(tempCost)
print("$" + tempCost, "and", tempHours, "hours per day") print(fgColor.GREEN,"$" + tempCost, "and", tempHours, "work hours per day",fgColor.NC)
tempCost = format(cost * packs * 7, '.2f') tempCost = format(cost * packs * 7, '.2f')
tempHours = calcHours(tempCost) tempHours = calcHours(tempCost)
print("$" + tempCost, "and", tempHours, "hours per week") print(fgColor.GREEN,"$" + tempCost, "and", tempHours, "work hours per week",fgColor.NC)
tempCost = format((cost * packs * 365)/12, '.2f') tempCost = format((cost * packs * 365)/12, '.2f')
tempHours = calcHours(tempCost) tempHours = calcHours(tempCost)
print("$" + tempCost, "and", tempHours, "hours per month") print(fgColor.GREEN,"$" + tempCost, "and", tempHours, "work hours per month",fgColor.NC)
tempCost = format(cost * packs * 365, '.2f') tempCost = format(cost * packs * 365, '.2f')
tempHours = calcHours(tempCost) tempHours = calcHours(tempCost)
print("$" + tempCost, "and", tempHours, "hours per year") print(fgColor.GREEN,"$" + tempCost, "and", tempHours, "work hours per year",fgColor.NC)