aboutscript

aboutscript

Joined
Jan 05, 2013

Activity Stream

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
aboutscript created a Page  -  Jan 05, 2013
1 321 

Find out if a number is prime. If it isn't, you'll get a list of factors. It's useful for finding GCM and other miscellaneous things about numbers.

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.