From ad5cdcbaf4100efd43834e62792aa3f543c42ca0 Mon Sep 17 00:00:00 2001 From: Dharani M <186461332+its-dharani@users.noreply.github.com> Date: Sun, 31 May 2026 12:40:52 +0530 Subject: [PATCH 1/2] Create rockpaperscissors.py --- Rock_Paper_Scissors/rockpaperscissors.py | 57 ++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Rock_Paper_Scissors/rockpaperscissors.py diff --git a/Rock_Paper_Scissors/rockpaperscissors.py b/Rock_Paper_Scissors/rockpaperscissors.py new file mode 100644 index 00000000..b93babac --- /dev/null +++ b/Rock_Paper_Scissors/rockpaperscissors.py @@ -0,0 +1,57 @@ +import random + +choices = ["rock", "paper", "scissors"] + +print("Welcome to Rock, Paper, Scissors!") +print("Best of 3 Rounds") + +while True: + user_score = 0 + computer_score = 0 + round = 0 + + while round < 3: + print("\nRound", round + 1) + + user = input("Enter rock, paper, or scissors: ").lower() + + if user not in choices: + print("Invalid choice") + continue + + computer = random.choice(choices) + + print("You chose:", user) + print("Computer chose:", computer) + + if user == computer: + print("It's a tie!") + elif ( + (user == "rock" and computer == "scissors") or + (user == "paper" and computer == "rock") or + (user == "scissors" and computer == "paper") + ): + user_score += 1 + print("You get a point!") + else: + computer_score += 1 + print("Computer gets a point!") + + round += 1 + + print("\nFinal Score") + print("You:", user_score) + print("Computer:", computer_score) + + if user_score > computer_score: + print("You win the game!") + elif computer_score > user_score: + print("Computer wins the game!") + else: + print("The game is a tie!") + + play_again = input("\nDo you want to play again? (yes/no): ").lower() + + if play_again != "yes": + print("Thanks for playing!") + break From e18bda42dc7245332e5f259e1fc846389edeabaf Mon Sep 17 00:00:00 2001 From: Dharani M <186461332+its-dharani@users.noreply.github.com> Date: Sun, 31 May 2026 12:48:34 +0530 Subject: [PATCH 2/2] Create README.md --- Rock_Paper_Scissors/README.md | 77 +++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 Rock_Paper_Scissors/README.md diff --git a/Rock_Paper_Scissors/README.md b/Rock_Paper_Scissors/README.md new file mode 100644 index 00000000..7336f304 --- /dev/null +++ b/Rock_Paper_Scissors/README.md @@ -0,0 +1,77 @@ + +![Star Badge](https://img.shields.io/static/v1?label=%F0%9F%8C%9F&message=If%20Useful&style=flat&color=BC4E99) +![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103) +![Python](https://img.shields.io/badge/Python-3.x-blue) +![Beginner Friendly](https://img.shields.io/badge/Beginner-Friendly-brightgreen) + +# Rock Paper Scissors + +## 🛠️ Description + +A simple command-line Rock Paper Scissors game written in Python. The player competes against the computer, which randomly selects Rock, Paper, or Scissors. The game determines the winner based on the classic rules. + +## ⚙️ Languages or Frameworks Used + +- Python 3 +- Built-in modules: + - `random` + +## 🌟 How to Run + +Open a terminal in the project directory and run: + +```bash +python rock_paper_scissors.py +``` + +If that doesn't work, try: + +```bash +python3 rock_paper_scissors.py +``` + +## 🎮 Features + +- Play against the computer +- Random computer choices +- Winner determination +- Simple and beginner-friendly code + +## 📺 Demo + +```text +Welcome to Rock, Paper, Scissors! +Best of 3 Rounds + +Round 1 +Enter rock, paper, or scissors: rock +You chose: rock +Computer chose: paper +Computer gets a point! + +Round 2 +Enter rock, paper, or scissors: paper +You chose: paper +Computer chose: rock +You get a point! + +Round 3 +Enter rock, paper, or scissors: rock +You chose: rock +Computer chose: rock +It's a tie! + +Final Score +You: 1 +Computer: 1 +The game is a tie! + +Do you want to play again? (yes/no): no +Thanks for playing! +``` + +## 🤖 Author + +Dharani + +GitHub: https://github.com/its-dharani