#randint() from the random library
from random import randint
#clear_output() from the IPython.display library (Jupyter Only)
from IPython.display import clear_output
#sleep() from the time library
from time import sleep
# here i am declaring my variables
#The response variable is a list that contains all of the answers
response = ["As I see it, yes.", "Ask again later.", "Better not tell you now.", "Cannot predict now.", "Concentrate and ask again.", "Don’t count on it.", "It is certain.", "It is decidedly so.", "Most likely.", "My reply is no.", "My sources say no.", "Outlook not so good.", "Outlook good.", "Reply hazy, try again.", "Signs point to yes.", "Very doubtful.", "Without a doubt.", "Yes.", "Yes - definitely.", "You may rely on it."]
#Exit function asking if I want to go again.
def leave():
exitQuestion = input("Do you want to go again? Y,y or N,n ==> ")
if exitQuestion == "Y" or exitQuestion == "y":
main()
elif exitQuestion == "N" or exitQuestion == "n":
clear_output()
print("Have a mystical or random day!(your call...)")
else:
leave()
def main():
#sleep timer a random generator to give the impression of thought
sleepTimer = randint(3, 6)
#responseItem which is a random number generated betwwen 0 and 19 which will allow me to pick a random item from the response list
responseItem = randint(0,19)
#input asking question
question = input("What is you question, If you think real hard on it, the Mystical oracle will know the question ==> ")
#If I leave the question blank, the program puts out a stock remark about my secret question
if question == "":
question = "Here is the answer to your secret question."
#clears the screen
clear_output()
print("I am formulating your answer...")
#Here i am running the sleep command between 3 and 6 seconds based on the sleepTimer variable
sleep(sleepTimer)
clear_output()
#I print out my answer...notice the \n in the print statement, that force a line break.
print("{} \n".format(question))
print(response[responseItem])
#I run the leave function asking if I want to exit.
leave()
main()