init
This commit is contained in:
commit
40047fce90
36
cost-of-smokes.py
Normal file
36
cost-of-smokes.py
Normal file
@ -0,0 +1,36 @@
|
||||
#!/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")
|
||||
continue
|
||||
|
||||
try:
|
||||
packs = float(input("How many packs do you smoke a day? "))
|
||||
except ValueError:
|
||||
print("Please only type numbers")
|
||||
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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user