This repository was archived by the owner on Jul 13, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 450
Expand file tree
/
Copy pathRock Paper Scissor.py
More file actions
58 lines (52 loc) 路 2.11 KB
/
Copy pathRock Paper Scissor.py
File metadata and controls
58 lines (52 loc) 路 2.11 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
# Username:Madhuj275
#Aim : Implement Rock Paper Scissor Game using Algorithm
# Date: 28/10/24
import random
choices = ['rock', 'paper', 'scissors']
comp_choice = random.choice(choices)
player_wins = 0
comp_wins = 0
tie = 0
print("Welcome to [Rock Paper Scissors]")
while True:
comp_choice = random.choice(choices)
answer = input("----Type [play] to play, [exit] to exit------\n")
if answer == "play":
while True:
choice = input("Enter you choice [rock/paper/scissors] :\n")
choice = choice.lower()
if choice == 'rock' and comp_choice == 'paper':
print("- Computer chose paper\n[!] Computer Wins!")
comp_wins += 1
break
elif choice == 'rock' and comp_choice == 'scissors':
print("- Computer chose scissors\n[!] Yon Win!")
player_wins += 1
break
elif choice == 'paper' and comp_choice == 'rock':
print("- Computer chose rock\n[!] You Win!")
player_wins += 1
break
elif choice == 'paper' and comp_choice == 'scissors':
print("- Computer chose scissors\n[!] Computer Wins!")
comp_wins += 1
break
elif choice == 'scissors' and comp_choice == 'rock':
print("- Computer chose rock\n[!] Computer Wins!")
comp_wins += 1
break
elif choice == 'scissors' and comp_choice == 'paper':
print("- Computer chose paper\n[!] You Win!")
player_wins += 1
break
elif choice == comp_choice:
print(f"- Computer chose {comp_choice}\n[!] It's a Tie!")
tie += 1
break
else: print(" Not a valid choice, Try again")
elif answer == "exit":
break
else:
print("[~] Not a valid answer, Try again")
print(f"- You won {player_wins} times\n- Computer wins {comp_wins} times\n- It was a tie {tie} times")
print("-------------- Thanks for playing!-------------------")