Decided to play around with python for a bit. I saw anish's 8ball in perl and I thought I would do one in python.
I just started python today so if you want to tell me what I could improve with it that would be great.
Need python 2.6 for this to work. Save this file to filename.py where filename is a name of your choice then run it with python filename.py
#! /usr/bin/env python import sys,re,random while True: x = raw_input("Please ask a question: ") n = random.randint(1, 7) if re.match("^exit$|^close$", x): print "GoodBye!" sys.exit() elif n == 1: print "The answer lies in your heart" elif n == 2: print "I do not know" elif n == 3: print "Almost certainly" elif n == 4: print "No" elif n == 5: print "Why do you need to ask?" elif n == 6: print "Go away. I do not wish to answer at this time." elif n == 7: print "Time will only tell"