File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ from time import sleep
2+ from random import randint
3+ from colorama import Fore , Style
4+ response = [
5+ "It is certain" ,
6+ "It is decidedly so" ,
7+ "Without a doubt" ,
8+ "Yes, definitely" ,
9+ "You may rely on it" ,
10+ "As I see it, yes" ,
11+ "Most likely" ,
12+ "Outlook good" ,
13+ "Yes" ,
14+ "Signs point to yes" ,
15+ "Quite possibly so" ,
16+ "Ask again later" ,
17+ "Better not tell you now" ,
18+ "Cannot predict now" ,
19+ "Concentrate and ask again" ,
20+ "Don't count on it" ,
21+ "My reply is no" ,
22+ "My sources say no" ,
23+ "Outlook not so good" ,
24+ "Very doubtful" ]
25+
26+ def game ():
27+ ques = str (input ("What is your question? \n " ).lower ())
28+ print ("thinking..." )
29+ sleep (1 )
30+ idx = randint (0 ,20 )
31+ if idx < 10 : color = Fore .GREEN
32+ elif idx >= 10 and idx < 15 : color = Fore .YELLOW
33+ else : color = Fore .RED
34+ print (color + response [idx ]+ Style .RESET_ALL + '\n \n ' )
35+ playloop ()
36+
37+
38+ def playloop ():
39+ ques_again = str (input ("Would you like to ask another question? (y/n)\n " ).lower ())
40+ if ques_again == 'y' :
41+ game ()
42+
43+ elif ques_again == 'n' :
44+ print ("Auf Wiedersehen!" )
45+
46+ else :
47+ print ("What was that?/n" )
48+ playloop ()
49+
50+ if __name__ == '__main__' :
51+ game ()
You can’t perform that action at this time.
0 commit comments