0% found this document useful (0 votes)
2 views1 page

Scissors

This document is a Python script for a Rock, Paper, Scissors game. It allows a user to play against the computer, keeps track of scores, and prompts the user to play again. The game continues until the user chooses not to play anymore.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Scissors

This document is a Python script for a Rock, Paper, Scissors game. It allows a user to play against the computer, keeps track of scores, and prompts the user to play again. The game continues until the user chooses not to play anymore.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import random

print("Welcome to Rock, Paper, Scissors!")


play_again = 'yes'
user_score = 0
computer_score = 0

while play_again.lower() == 'yes':


user_choice = input("Enter a choice (rock, paper, scissors): ").lower()
while user_choice not in ["rock", "paper", "scissors"]:
user_choice = input("Invalid input. Enter a choice (rock, paper, scissors):
").lower()

possible_choices = ["rock", "paper", "scissors"]


computer_choice = random.choice(possible_choices)

print("User chose " + user_choice +", computer chose " + computer_choice)

if user_choice == computer_choice:
print("It's a tie!")
elif (user_choice == "rock" and computer_choice == "scissors") or \
(user_choice == "paper" and computer_choice == "rock") or \
(user_choice == "scissors" and computer_choice == "paper"):
print("User Win")
user_score += 1
else:
print("Computer Win")
computer_score += 1

print(f"Score - User: {user_score}, Computer: {computer_score}\n")


play_again = input("Play again? (yes/no): ")
while play_again.lower() not in ["yes", "no"]:
play_again = input("Invalid input. Play again? (yes/no): ")

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy