Skip to content

A Python Rock, Paper, Scissors game where you compete against the computer. Input your choice, and the program displays the computer’s choice along with the result. Simple, interactive, and easy to run, this game showcases basic Python programming and game logic.

Notifications You must be signed in to change notification settings

rkstudio585/rock-paper-scissors-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Rock, Paper, Scissors Game 🪨📄✂️


In C Script

Logo


Welcome to the Python version of the Rock, Paper, Scissors game! This command-line game allows you to challenge the computer in a classic game of Rock, Paper, Scissors. Play to see who wins!

Table of Contents 📚

  1. Introduction
  2. Features
  3. How to Run
  4. Gameplay Instructions
  5. Code Explanation

Introduction

This project is a straightforward implementation of the Rock, Paper, Scissors game in Python. It demonstrates basic concepts like user input handling, random choice generation, and simple game logic.

Features 🌟

  • Play Rock, Paper, Scissors against the computer 🤖
  • Clear and informative output 💬
  • Randomized computer choices 🎲
  • Easy to run and understand code 🧩

How to Run 🚀

  1. Clone the Repository:

    git clone https://github.com/mdriyadkhan585/rock-paper-scissors-python.git
  2. Navigate to the Project Directory:

    cd rock-paper-scissors-python
  3. Run the Program: Make sure you have Python installed, then execute:

    python rock_paper_scissors.py

Gameplay Instructions 🎮

  1. Start the Game: After running the program, you’ll be prompted to enter your choice.

  2. Enter Your Choice:

    • Type Rock 🪨
    • Type Paper 📄
    • Type Scissors ✂️
  3. View the Results: The program will display the computer's choice and the result of the game (win, lose, or tie).

  4. Play Again: You can run the program again to play another round.

Code Explanation 🛠️

  1. Getting the Computer's Choice:

    def get_computer_choice():
        return random.choice(['Rock', 'Paper', 'Scissors'])
    • Uses the random.choice function to select a random choice for the computer.
  2. Determining the Winner:

    def determine_winner(player_choice, computer_choice):
        # Compares choices and prints the result
    • Compares player and computer choices and prints whether the player won, lost, or tied.
  3. User Input and Validation:

    player_choice = input("Your choice: ").capitalize()
    • Prompts the user to enter their choice and capitalizes the input to match the expected format.
  4. Formatted Output:

    • Displays user and computer choices, and announces the result in a clear and engaging format.

About

A Python Rock, Paper, Scissors game where you compete against the computer. Input your choice, and the program displays the computer’s choice along with the result. Simple, interactive, and easy to run, this game showcases basic Python programming and game logic.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages