File tree 2 files changed +40
-0
lines changed
2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Rock, paper, Scissors
2
+
3
+ A rock, paper, scissors game program
Original file line number Diff line number Diff line change
1
+ from random import uniform
2
+
3
+ elements = ["rock" , "paper" , "scissors" ]
4
+
5
+ print ("1) Rock" )
6
+ print ("2) Paper" )
7
+ print ("3) Scissors" )
8
+ print ()
9
+
10
+ player_choice = int (input ("Your choice: " ))
11
+ computer_choice = int (uniform (1 , 3 ))
12
+
13
+ print ("Player's choice: " , end = "" )
14
+ print (elements [player_choice - 1 ])
15
+ print ()
16
+
17
+ print ("Computer's choice: " , end = "" )
18
+ print (elements [computer_choice - 1 ])
19
+ print ()
20
+
21
+ if (player_choice == computer_choice ):
22
+ print ("This game is draw." )
23
+ elif (player_choice == 1 ):
24
+ if (computer_choice == 2 ):
25
+ print ("You lose." )
26
+ else :
27
+ print ("You win." )
28
+ elif (player_choice == 2 ):
29
+ if (computer_choice == 3 ):
30
+ print ("You lose." )
31
+ else :
32
+ print ("You win." )
33
+ elif (player_choice == 3 ):
34
+ if (computer_choice == 1 ):
35
+ print ("You lose." )
36
+ else :
37
+ print ("You win." )
You can’t perform that action at this time.
0 commit comments