File tree Expand file tree Collapse file tree 2 files changed +133
-0
lines changed Expand file tree Collapse file tree 2 files changed +133
-0
lines changed Original file line number Diff line number Diff line change 1+ import random
2+
3+ def qiz_1 ():
4+
5+ print ("_-_-_-_-_-_-_- welcome to my quiz game _-_-_-_-_-_- \n " )
6+
7+
8+ user = input ("if you want to play please type yes :" )
9+ if user == "yes" :
10+
11+ print ("what is the full form of cpu" )
12+ user_1 = input ("answer :: " )
13+
14+
15+ if user_1 == ("central processing unit" ):
16+ print ("correct answer " )
17+ else :
18+ print ("wrong answer \n " )
19+
20+
21+
22+
23+
24+ user_2 = (input ("if you want to see the next question please type yes :" ))
25+
26+ if user_2 == "yes" :
27+
28+ user_2 = input (" what is the full form of RAM :" )
29+ if user_2 == "random access memory" :
30+ print ("correct answer\n " )
31+
32+ else :
33+ print ("wrong answer \n " )
34+
35+
36+
37+ user_3 = input ("if you want to continue please type yes :\n " )
38+
39+ if user_3 == "yes" :
40+ user_3 = input ("what is the full form of ROM :\n " )
41+
42+ else :
43+ print ("thankyou for playing" )
44+
45+ if user_3 == "read only memory" :
46+ print ("correct answer" )
47+
48+ else :
49+ print ("wrong answer " )
50+
51+
52+ print ("_-_-_-_-_-_-_- going well letss continue _-_-_-_-_-_-_-\n " )
53+
54+ user_4 = input (" How is the resolution of the screen shown?[in pixels / in dots]" )
55+ if user_4 == "in pixels" :
56+ print ("correct answer" )
57+ print ("_-_-_-_-_-_-_-_ GAME OVER _-_-_-_-_-_-_-_" )
58+ else :
59+ print ("wrong answer " )
60+
61+
62+
63+
64+
65+ def again ():
66+
67+
68+ qiz_again = input ('''
69+ if you want to play from starting please type [ y / n ]
70+ ''' )
71+
72+
73+ if qiz_again == 'y' :
74+ qiz_1 ()
75+ elif qiz_again == 'n' :
76+ print ('thankyou.' )
77+ else :
78+ again ()
79+
80+
81+ qiz_1 ()
82+
83+
84+ again ()
85+
Original file line number Diff line number Diff line change 1+ import random #using random module
2+
3+ def game ():
4+
5+ print ("_-_-_-_-_ lets start _ _-_-_-_- " )
6+
7+ choices = ['rock' , 'paper' , 'scissors' ]
8+ computer_choice = random .choice (choices )
9+ user_choice = None
10+ while user_choice not in choices :
11+ user_choice = input ('Enter your choice (rock, paper, scissors): ' ).lower ()
12+ if user_choice == computer_choice :
13+ print ('Tie!' )
14+ elif (user_choice == 'rock' and computer_choice == 'scissors' ) or \
15+ (user_choice == 'paper' and computer_choice == 'rock' ) or \
16+ (user_choice == 'scissors' and computer_choice == 'paper' ):
17+ print ('wow you won the game!' )
18+ else :
19+ print ('You lose!' )
20+
21+ game ()
22+
23+
24+
25+ def again ():
26+
27+
28+ game_again = input ('''
29+ play agian?
30+ type [y / n]
31+ ''' )
32+
33+
34+ if game_again == 'y' :
35+ game ()
36+ elif game_again == 'n' :
37+ print ('thanks for playing.' )
38+ else :
39+ again ()
40+
41+
42+ game ()
43+
44+
45+ again ()
46+
47+
48+
You can’t perform that action at this time.
0 commit comments