Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. #magic 8 ball
  2.  
  3. from random import randint
  4. from time import sleep
  5.  
  6. ans=["yes" ,"no", "maybe","no way!"]
  7. length=len(ans)
  8. print(length)
  9. def spin():
  10.     global rand
  11.     rand=randint(0,(length-1))
  12.     print(rand)
  13.  
  14. def play():
  15.     global rand
  16.     print("you have three questions to ask...")
  17.     for i in range(1,4):
  18.         print(" ask question number", i)
  19.         sleep(2)
  20.         spin()
  21.         print("you ansewer is", ans[rand])
  22.  
  23. play()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement