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!
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.
- Play Rock, Paper, Scissors against the computer 🤖
- Clear and informative output 💬
- Randomized computer choices 🎲
- Easy to run and understand code 🧩
-
Clone the Repository:
git clone https://github.com/mdriyadkhan585/rock-paper-scissors-python.git
-
Navigate to the Project Directory:
cd rock-paper-scissors-python
-
Run the Program: Make sure you have Python installed, then execute:
python rock_paper_scissors.py
-
Start the Game: After running the program, you’ll be prompted to enter your choice.
-
Enter Your Choice:
- Type
Rock
🪨 - Type
Paper
📄 - Type
Scissors
✂️
- Type
-
View the Results: The program will display the computer's choice and the result of the game (win, lose, or tie).
-
Play Again: You can run the program again to play another round.
-
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.
- Uses the
-
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.
-
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.
-
Formatted Output:
- Displays user and computer choices, and announces the result in a clear and engaging format.