cig-cost/cost-of-smokes.py

39 lines
880 B
Python

#!/usr/bin/python3
#user input dolloars
#user input number of packs
#output day, week, month year costs
import os
cost = None
packs = None
while True:
os.system('clear')
try:
cost = float(input("How much does a pack cost? "))
except ValueError:
print("Please only type numbers")
input("Press 'enter' to continue: ")
continue
try:
packs = float(input("How many packs do you smoke a day? "))
except ValueError:
print("Please only type numbers")
input("Press 'enter' to continue: ")
continue
break
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")