GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Python/magic8ball.py at master · TensorUI/Python Expand file tree/ Copy pathmagic8ball.pyMore file actions 68 lines (58 loc) · 1.45 KB / Copy pathmagic8ball.pyFile metadata and controls68 lines (58 loc) · 1.45 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 '''Author Anurag Kumar([email protected]) Module for implementing the simpest Magic 8 Ball Game. Python: - 3.5 Requirements: - colorama Usage: - $python3 magic8ball.py Ask a question, and know the future. ''' from time import sleep from random import randint from colorama import Fore, Style # response list.. response = [ "It is certain", "It is decidedly so", "Without a doubt", "Yes, definitely", "You may rely on it", "As I see it, yes", "Most likely", "Outlook good", "Yes", "Signs point to yes", "Quite possibly so", "Ask again later", "Better not tell you now", "Cannot predict now", "Concentrate and ask again", "Don't count on it", "My reply is no", "My sources say no", "Outlook not so good", "Very doubtful"] # core game... def game(): ques = str(input("What is your question? \n").lower()) print ("thinking...") sleep(1) idx = randint(0,20) if idx <10: color = Fore.GREEN elif idx>=10 and idx<15: color = Fore.YELLOW else: color = Fore.RED print (color+response[idx]+Style.RESET_ALL+'\n\n') playloop() # looping func... def playloop(): ques_again = str(input("Would you like to ask another question? (y/n)\n").lower()) if ques_again == 'y': game() elif ques_again == 'n': print("Auf Wiedersehen!") else: print ("What was that?/n") playloop() if __name__=='__main__': game() |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |