asweigart

magicfortuneball.py

May 12th, 2021 (edited)
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.53 KB | None | 0 0
  1. import random, time
  2.  
  3. def slowPrint(text):
  4.     for character in text:
  5.         if character == 'I':
  6.             # I's are displayed in lowercase for style:
  7.             print('i ', end='', flush=True)
  8.         else:
  9.             # All other characters are displayed normally:
  10.             print(character + ' ', end='', flush=True)
  11.         time.sleep(0.1)
  12.     print()  # Print two newlines at the end.
  13.     print()
  14.  
  15.  
  16. # Prompt for a question:
  17. slowPrint('MAGIC FORTUNE BALL')
  18. time.sleep(0.5)
  19. slowPrint('ASK ME YOUR YES/NO QUESTION.')
  20. input('> ')
  21.  
  22. # Display a brief reply:
  23. replies = [
  24.     'LET ME THINK ON THIS...',
  25.     'AN INTERESTING QUESTION...',
  26.     'HMMM... ARE YOU SURE YOU WANT TO KNOW..?',
  27.     'DO YOU THINK SOME THINGS ARE BEST LEFT UNKNOWN..?',
  28.     'I MIGHT TELL YOU, BUT YOU MIGHT NOT LIKE THE ANSWER...',
  29.     'YES... NO... MAYBE... I WILL THINK ON IT...',
  30.     'AND WHAT WILL YOU DO WHEN YOU KNOW THE ANSWER? WE SHALL SEE...',
  31.     'I SHALL CONSULT MY VISIONS...',
  32.     'YOU MAY WANT TO SIT DOWN FOR THIS...',
  33. ]
  34. slowPrint(random.choice(replies))
  35.  
  36. slowPrint('.' * random.randint(4, 12)) # Dramatic pause.
  37.  
  38. slowPrint('I HAVE AN ANSWER...')
  39. time.sleep(1)
  40. answers = [
  41.     'YES, FOR SURE',
  42.     'MY ANSWER IS NO',
  43.     'ASK ME LATER',
  44.     'I AM PROGRAMMED TO SAY YES',
  45.     'THE STARS SAY YES, BUT I SAY NO',
  46.     'I DUNNO MAYBE',
  47.     'FOCUS AND ASK ONCE MORE',
  48.     'DOUBTFUL, VERY DOUBTFUL',
  49.     'AFFIRMATIVE',
  50.     'YES, THOUGH YOU MAY NOT LIKE IT',
  51.     'NO, BUT YOU MAY WISH IT WAS SO',
  52. ]
  53. slowPrint(random.choice(answers))
  54.  
Add Comment
Please, Sign In to add comment