0% found this document useful (0 votes)
9 views2 pages

Rock Paper Scissors Program

This document contains a Python script for a rock-paper-scissors game where a player competes against the computer. The player inputs their choice, and the computer randomly selects one of the options. The script determines the winner based on the rules of the game and allows the player to play multiple rounds until they choose to stop.

Uploaded by

ashwinnaira123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

Rock Paper Scissors Program

This document contains a Python script for a rock-paper-scissors game where a player competes against the computer. The player inputs their choice, and the computer randomly selects one of the options. The script determines the winner based on the rules of the game and allows the player to play multiple rounds until they choose to stop.

Uploaded by

ashwinnaira123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

import random

options = ("rock","paper","scissors")

running = True

while running :

player = None

computer = random.choice(options)

while player not in options :

player = input("Enter a choice (rock , paper , scissors) : ")

print(f"Player = {player}")

print(f"Computer = {computer}")

if player == computer :

print("Tie")

elif player == "paper" and computer == "rock":

print ("Player wins !")

elif player == "paper" and computer == "scissors" :

print ("Computer wins")

elif player == "rock" and computer == "paper" :

print("Computer wins")

elif player == "rock" and computer == "scissors" :

print("Player wins")

elif player == "scissors" and computer == "paper" :

print("Player wins")

else:

print("Computer wins")
if not input("Play Again?(y/n): ").lower() == "y" :

running = False

print("Thanks for playing !")

You might also like