# Python Sobriety Script 2022
from datetime import datetime
import time
def days_between(d1, d2):
d1 = datetime.strptime(d1, "%Y-%m-%d")
d2 = datetime.strptime(d2, "%Y-%m-%d")
return abs((d2 - d1).days)
### Hard Coded Values ###
stop_date = "2022-02-11"
daily_booze_cost = 24
relapse_days = 55
last_relapse_day = "2023-02-22"
### Hard Coded Values ###
todays_date = datetime.today().strftime('%Y-%m-%d')
#print("stop date: " + stop_date)
#print("todays date: " + todays_date)
total_num_days = days_between(stop_date, todays_date)
sober_days = days_between(stop_date, todays_date) - relapse_days
percent_sober = ( sober_days / total_num_days ) * 100
cont_num_days = days_between(last_relapse_day, todays_date)
print("Total days: " + str(total_num_days))
print("Total days sober: " + str(sober_days))
print("Percentage sober: " + str(round(percent_sober, 2)) + "%")
print("Continuously sober days: " + str(cont_num_days))
total_saved = sober_days * daily_booze_cost
print("Total money saved: $" + str(total_saved))
print("\nGood work! Keep going!")
# Dummy input to keep window open
input()