forked from logenkain/cig-cost
Calculate hours spent
This commit is contained in:
parent
3b622e0158
commit
ef0d0d9eae
@ -8,6 +8,12 @@ import math
|
|||||||
cost = None
|
cost = None
|
||||||
packs = None
|
packs = None
|
||||||
|
|
||||||
|
|
||||||
|
def calcHours(tempCost):
|
||||||
|
return format(float(tempCost)/wages, '.2f')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
os.system('clear')
|
os.system('clear')
|
||||||
try:
|
try:
|
||||||
@ -23,10 +29,17 @@ while True:
|
|||||||
print("Please only type numbers")
|
print("Please only type numbers")
|
||||||
input("Press 'enter' to continue: ")
|
input("Press 'enter' to continue: ")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
try:
|
||||||
|
wages = float(input("What is your hourly wage? "))
|
||||||
|
except ValueError:
|
||||||
|
print("Please only type numbers")
|
||||||
|
input("Press 'enter' to continue: ")
|
||||||
|
continue
|
||||||
|
|
||||||
os.system('clear')
|
os.system('clear')
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
print("Your cigarettes cost $" + format(cost/20, '.2f'), "each")
|
print("Your cigarettes cost $" + format(cost/20, '.2f'), "each")
|
||||||
|
|
||||||
print()
|
print()
|
||||||
@ -39,8 +52,20 @@ print(math.ceil(20 * packs * 365), "per year")
|
|||||||
print()
|
print()
|
||||||
|
|
||||||
print("This costs you: ")
|
print("This costs you: ")
|
||||||
print("$" + format(cost * packs, '.2f'), "Per day")
|
|
||||||
print("$" + format(cost * packs * 7, '.2f'), "per week")
|
tempCost = format(cost * packs, '.2f')
|
||||||
print("$" + format((cost * packs * 365)/12, '.2f'), "per month")
|
tempHours = calcHours(tempCost)
|
||||||
print("$" + format(cost * packs * 365, '.2f'), "per year")
|
print("$" + tempCost, "and", tempHours, "hours per day")
|
||||||
|
|
||||||
|
tempCost = format(cost * packs * 7, '.2f')
|
||||||
|
tempHours = calcHours(tempCost)
|
||||||
|
print("$" + tempCost, "and", tempHours, "hours per week")
|
||||||
|
|
||||||
|
tempCost = format((cost * packs * 365)/12, '.2f')
|
||||||
|
tempHours = calcHours(tempCost)
|
||||||
|
print("$" + tempCost, "and", tempHours, "hours per month")
|
||||||
|
|
||||||
|
tempCost = format(cost * packs * 365, '.2f')
|
||||||
|
tempHours = calcHours(tempCost)
|
||||||
|
print("$" + tempCost, "and", tempHours, "hours per year")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user