Skip to content

Commit

Permalink
Create rock_paper_scissors_game.py
Browse files Browse the repository at this point in the history
Added code for a rock paper scissors game
  • Loading branch information
anema25 authored Oct 22, 2024
1 parent c41ecfb commit b5c5545
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Python/rock_paper_scissors_game.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import random

choices = ["rock", "paper", "scissors"]
computer_choice = random.choice(choices)
player_choice = input("Enter rock, paper, or scissors: ").lower()

if player_choice == computer_choice:
print("It's a tie!")
elif (player_choice == "rock" and computer_choice == "scissors") or \
(player_choice == "scissors" and computer_choice == "paper") or \
(player_choice == "paper" and computer_choice == "rock"):
print(f"You win! {player_choice} beats {computer_choice}")
else:
print(f"You lose! {computer_choice} beats {player_choice}")

0 comments on commit b5c5545

Please sign in to comment.