Skip to content

Instantly share code, notes, and snippets.

@danwilldev
Created October 7, 2015 16:10
Show Gist options
  • Save danwilldev/79a7779b7771836897dd to your computer and use it in GitHub Desktop.
Save danwilldev/79a7779b7771836897dd to your computer and use it in GitHub Desktop.
#This is my death generating program! Created by Daniel Williams, feel free to use and share improvments!
import random
print('This is a program to guess your death age!')
age = int(input('How old are you? '))
print('So you are %s years old?'% age)
userinput = input('NO CAPS: Yes or No?: ')
if userinput == 'no':#Loops from here :)
print('You made a mistake!')
print('Restart the program')
raise SystemExit #Remember for test, ends code.
elif userinput == 'yes':
if age > 129:
print('I doubt you have lived this long ;)')
elif age > 50:
death_age = age + random.randint(1,60)
print ('You will die, aged: %s' % death_age)
reason_of_death = random.choice(['Over Eating','A Car Crash','Murder','Natural Causes','An Accident','Your Terrible Cooking'])
print('You will die because of: %s' % reason_of_death)
else:
death_age = age + random.randint(1,90)
print ('You will die, aged: %s' % death_age)
reason_of_death = random.choice(['Over Eating','A Car Crash','Murder','Natural Causes','Your Terrible Cooking'])
print('You will die because of: %s' % reason_of_death)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment