Magic 8 Ball.py (project)

Bulldog
by Bulldog · 3 posts
9 years ago in Python
Posted 9 years ago · Author
GOT ANY QUESTIONS? DIRECT THEM TO MAGIC 8 BALL. :lol:

Really though. i was looking for a project to do in python. came across the ''MAGIC 8 BALL" project on stackoverflow site. i thought it was cool. so i decided to tackle it. check it out:

( this was good practice for me)

Code
# MAGIC 8 BALL | FEEL FREE TO ASK YOUR QUESTIONS
# by. BULLDOG / 6:06 :AM

import random
import time

#******** function #2 begins **********************#
def userPrompt():
   
    time.sleep(3.0)
    print(".....")
    this_input = raw_input("Would you like to ask another question? Y/N :")
   
   
    if this_input == "y" or this_input == "Y":
       user = raw_input("Ask: a ?: ")
       randomResponse()

    elif this_input == "n" or this_input == "N":
        print("MAGIC 8 BALL WILL NOW GO TO SLEEP.")
  #******** function #2 ends **********************#
       
       
 #******** function #1 begins **********************#       
def randomResponse():

    response = ["Only god knows","Signs point to yes","Without a doubt","Jacob","Cannot predict now","Don't count on it","No","Yes","Ask again later","hello","i dont see why not","It is decidedly so","Most likely","Are you kidding?","Go for it!","Goodbye","me","Who knows?","life is full of excitement","Stuff happens","Don't bet on it"]
    print(random.choice(response))
    userPrompt()

#******** function #1 ends **********************#

   
#**** Main function ***********#
user_q = raw_input("Ask a ?: ")

if user_q:
    print("Thinking.....")
    randomResponse()
   




Download the EXE :https://www.dropbox.com/s/hva02j74g73bbi7/Magic%208%20Ball.zip?dl=0

Create an account or sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here

SIGN IN NOW

Create an account

Sign up for a new account in our community. It's easy!

REGISTER A NEW ACCOUNT