-
Notifications
You must be signed in to change notification settings - Fork 150
/
Rock_Paper_Scissors.py
55 lines (42 loc) · 1.34 KB
/
Rock_Paper_Scissors.py
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
import random
print("Welcome to rock paper scissors game .....")
print("You have three chances greater the wins in individual game will increase your chance to win")
print("Press 0-->paper , 1-->rock , 2-->scissors")
comp = 0
player = 0
for i in range(3):
player_choice = input("Your turn")
comp_choice=random.randint(0,2)
print(f"you chose\t{player_choice} and computer chose\t{comp_choice}")
if int( player_choice) >2:
print("Enter number between 0,1,2")
break
if comp_choice == player_choice:
print("Its a tie.")
comp = comp + 1
player = player+ 1
if comp_choice == 0:
if player_choice == 1:
print("Computer wins.")
comp = comp + 1
else:
print("You win.")
player = player+ 1
elif comp_choice == 1:
if player_choice == 2:
print("Computer wins.")
comp = comp + 1
else:
print("You win.")
player = player+ 1
elif comp_choice == 2:
if player_choice == 0:
print("Computer wins.")
comp = comp + 1
else:
print("You win.")
player = player+ 1
if int(player) > int(comp):
print("Hurray!!You win!!!")
else:
print("Computer wins!! Better luck next time !!")