-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathrock_paper_scissor.py
More file actions
52 lines (37 loc) · 1.52 KB
/
rock_paper_scissor.py
File metadata and controls
52 lines (37 loc) · 1.52 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
#ROCK_PAPER_SCISSORS
new = input("do you wish to start a new game : Y/N ")
new = str(new)
if new == 'Y':
print("\n rock equals r , paper equals p , scissor equals s ")
player_1 = input("Player 1 : enter rock paper or scissor : ")
player_2 = input("Player 2 : enter rock paper or scissor : ")
while str(player_1) == str(player_2):
print("Its a draw")
player_1 = input("Player 1 : enter rock paper or scissor : ")
player_2 = input("Player 2 : enter rock paper or scissor : ")
player_1 = str(player_1)
player_2 = str(player_2)
while new == 'Y':
if player_1 == 'r' and player_2 == 's':
print("player 1 wins")
elif player_1 == 's' and player_2 == 'r':
print("player 2 wins")
if player_1 == 's' and player_2 == 'p':
print("player 1 wins")
elif player_1 == 'p' and player_2 == 's':
print("player 2 wins")
if player_1 == 'r' and player_2 == 'p':
print("player 2 wins")
elif player_1 == 'p' and player_2 == 'r':
print("player 1 wins")
new = input("do you wish to start a new game : Y/N ")
new = str(new)
if new == 'N':
print("game ends")
break
player_1 = input("Player 1 : enter rock paper or scissor : ")
player_2 = input("Player 2 : enter rock paper or scissor : ")
player_1 = str(player_1)
player_2 = str(player_2)
else:
print("game end")