aboutscript commented on a Page, Python 8ball script  -  Jan 05, 2013

My version.

#!/usr/bin/env python

import random

raw_input("Please ask a question: ")

bases = [
    "The answer lies in your heart"
    , "I do not know"
    , "Almost certainly"
    , "No"
    , "Instead, ask why you need to ask"
    , "Go away. I do not wish to answer at this time"
    , "Time will only tell"
]

suffixes = [
    "my child"
    , "young grasshopper"
]

resp = ', '.join([
    random.choice(bases)
    , random.choice(suffixes)
])

print resp

(change print resp to print(resp) for Python 3.x)

Example responses

The answer lies in your heart, young grasshopper
Time will only tell, my child
Instead, ask why you need to ask, young grasshopper
Lord-Harlot  -  Aug 28, 2013

I like it. Nice and simple. I can't really think of anyway that could be made simpler.

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.