Skip to content

Commit

Permalink
Merge pull request #94 from anema25/patch-1
Browse files Browse the repository at this point in the history
Create rock_paper_scissors_game.py
  • Loading branch information
YuweAEC authored Oct 24, 2024
2 parents a32708f + b5c5545 commit 3ae0e0e
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 3ae0e0e

Please sign in to comment.