Skip to content
This repository was archived by the owner on Oct 5, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions Python/Rock Paper Scissor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,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!-------------------")