Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #magic 8 ball
- from random import randint
- from time import sleep
- ans=["yes" ,"no", "maybe","no way!"]
- length=len(ans)
- print(length)
- def spin():
- global rand
- rand=randint(0,(length-1))
- print(rand)
- def play():
- global rand
- print("you have three questions to ask...")
- for i in range(1,4):
- print(" ask question number", i)
- sleep(2)
- spin()
- print("you ansewer is", ans[rand])
- play()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement