-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRock-Paper-Scissors.py
More file actions
72 lines (67 loc) · 2.6 KB
/
Rock-Paper-Scissors.py
File metadata and controls
72 lines (67 loc) · 2.6 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import random
def computers_choice():
lst = ["rock", "paper", "scissors"]
choice = random.choice(lst)
return choice
print("**************** WELCOME TO ROCK-PAPER-SCISSORS GAME *****************")
print("How many games do you want to play?")
number = int(input())
games_won = 0
i = 0
while i < number:
print("Enter your choice -- Rock,Paper,Scissors")
players_choice = input().lower()
choice1 = computers_choice()
if players_choice == "rock" and choice1 == "paper":
print("Your choice is", players_choice, "and", "Computers choice is", choice1)
print("Paper beats Rock,You Lost")
i += 1
continue
elif players_choice == "rock" and choice1 == "scissors":
print("Your choice is", players_choice, "and", "Computers choice is", choice1)
print("Rock beats Scissors,You Won")
games_won += 1
i += 1
continue
elif players_choice == "rock" and choice1 == "rock":
print("Your choice is", players_choice, "and", "Computers choice is", choice1)
print("It is a Draw by repetition")
i += 1
continue
elif players_choice == "paper" and choice1 == "paper":
print("Your choice is", players_choice, "and", "Computers choice is", choice1)
print("It is a Draw by repetition")
i += 1
continue
elif players_choice == "paper" and choice1 == "scissors":
print("Your choice is", players_choice, "and", "Computers choice is", choice1)
print("Scissors beats Paper,You Lost")
i += 1
continue
elif players_choice == "paper" and choice1 == "rock":
print("Your choice is", players_choice, "and", "Computers choice is", choice1)
print("Paper beats Rock,You Won")
i += 1
games_won += 1
continue
elif players_choice == "scissors" and choice1 == "paper":
print("Your choice is", players_choice, "and", "Computers choice is", choice1)
print("Scissors beats Paper,You Won")
i += 1
games_won += 1
continue
elif players_choice == "scissors" and choice1 == "scissors":
print("Your choice is", players_choice, "and", "Computers choice is", choice1)
print("It is a Draw by repetition")
i += 1
continue
elif players_choice == "scissors" and choice1 == "rock":
print("Your choice is", players_choice, "and", "Computers choice is", choice1)
print("Rock beats Scissors,You Lost")
i += 1
continue
else:
print("Enter Valid Choice!")
print("\n")
print("Total Games Won :", games_won)
print("Total Games Played :", number)