These are the original instructions:
"Design and write a python program that emulates a Magic Eight Ball. Your program should continually prompt the user to enter a question and then display the answer as long as the user wishes to continue.
Store eight Magic Eight Ball answers in an array. For every question that a user asks, an answer should be randomly selected from the list of answers. You are free to make up any answers you wish.
Your program must contain 4 functions that are all called from the main program. One to create and return the list of answers, one to get and return the user's question, one to generate and return a random number, and one to print the Magic Eight Ball answer."
I'm very new to the programming world and have had quite some trouble figuring out all the concepts, especially calling and returning functions.
Can anyone help?
This is what i have so far below
#Sam McDonnell #Lab 8-1 #This program uses arrays and the randint function to emulate a magic 8-ball import random #create an array of 8 elements eightBall = [0, 1, 2, 3, 4, 5, 6, 7] #function definitions #this function creates the list of answers #this function asks for users question and returns it #this function generates and returns a random number def shakeBall(): shake = random.randint(eightBall) return shake #this function prints the magic 8-ball answer eightBall = print “Can't tell you now” eightBall = print “It is certain” eightBall = print “Ask again later” eightBall = print “Yes” eightBall = print "Don’t count on it”, eightBall = print “My source says No” eightBall = print “Very doubtful” eightBall = print “Maybe” #main program print "Welcome to the magic 8-ball game!" print "Type a yes or no question to play, or type 'exit' to quit." while eightBall != (0,8): print "Thank you for playing" print "\nShaking the Ball. . . . " eightBall = shakeBall() print eightBall