Advertisement
DrAungWinHtut

Magic8Ball.py

Apr 22nd, 2022
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. # Magic 8 ball by Nicholas Tollervey. February 2016.
  2. #
  3. # Ask a question then shake.
  4. #
  5. # This program has been placed into the public domain.
  6. from microbit import *
  7. import random
  8.  
  9. # List
  10. answers = [
  11.     "It is certain",
  12.     "It is decidedly so",
  13.     "Without a doubt",
  14.     "Yes, definitely",
  15.     "You may rely on it",
  16.     "As I see it, yes",
  17.     "Most likely",
  18.     "Outlook good",
  19.     "Yes",
  20.     "Signs point to yes",
  21.     "Reply hazy try again",
  22.     "Ask again later",
  23.     "Better not tell you now",
  24.     "Cannot predict now",
  25.     "Concentrate and ask again",
  26.     "Don't count on it",
  27.     "My reply is no",
  28.     "My sources say no",
  29.     "Outlook not so good",
  30.     "Very doubtful",
  31. ]
  32.  
  33. while True:
  34.     display.show('8')
  35.    
  36.     if accelerometer.was_gesture('shake'):
  37.         display.clear()
  38.         sleep(1000)
  39.         display.scroll(random.choice(answers))
  40.        
  41.     sleep(10)  # Write your code here :-)
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement