Skip to content

Instantly share code, notes, and snippets.

@lrvick
Created January 28, 2015 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lrvick/dedee83bae51f062e9fb to your computer and use it in GitHub Desktop.
Save lrvick/dedee83bae51f062e9fb to your computer and use it in GitHub Desktop.
Python Happiness Calculator. (Don't ask)
present_happiness = 1
trauma_happiness = present_happiness/10
post_trauma_happiness = present_happiness*2
trauma_years = 1
years_left = 43
def calculate_happiness(procrastination_days):
total_days = years_left * 365
trauma_days = trauma_years * 365
post_trauma_days = (total_days - trauma_days - procrastination_days)
a = procrastination_days * present_happiness
b = trauma_days * trauma_happiness
c = post_trauma_days * post_trauma_happiness
return ( a + b + c )
def display_happiness_loss(procrastination_days):
optimal_happiness = calculate_happiness(1)
happiness_loss = optimal_happiness - \
calculate_happiness(procrastination_days)
print('happiness loss - procrastinate %s days: %s' \
% (procrastination_days, happiness_loss))
display_happiness_loss(1)
display_happiness_loss(60)
display_happiness_loss(365)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment