Skip to content

Instantly share code, notes, and snippets.

@VessoVit
Last active August 29, 2015 14:12
Show Gist options
  • Save VessoVit/85b865c71bccd4230546 to your computer and use it in GitHub Desktop.
Save VessoVit/85b865c71bccd4230546 to your computer and use it in GitHub Desktop.
Random generator for magic-8 ball...
import random
#1.It is certain
#2.It is decidedly so
#3.Without a doubt
#4.Yes definitely
#5.You may rely on it
#6.As I see it, yes
#7.Most likely
#8.Outlook good
#9.Yes
#10.Signs point to yes
#11.Reply hazy try again
#12.Ask again later
#13.Better not tell you now
#14.Cannot predict now
#15.Concentrate and ask again
#16.Don't count on it
#17.My reply is no
#18.My sources say no
#19.Outlook not so good
#20.Very doubtfu
category_choices = [('Green', 1), ('Yellow', 2), ('Red', 3)]
choose_cat = [val for val, cnt in category_choices for i in range(cnt)]
category = random.choice(choose_cat)
if (category == 'Green'):
print random.randint(1,10)
if (category == 'Yellow'):
print random.randint(11,15)
if (category == 'Red'):
print random.randint(16,20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment