A quickly put-together Python Rock - Paper - Scissors game!
import random
def play_game():
options = ["rock", "paper", "scissors"]
computer_choice = random.choice(options)
user_choice = input("Enter rock, paper, or scissors: ").lower()
if user_choice not in options:
print("Invalid input. Please try again.")
play_game()
print("You chose:", user_choice)
print("Computer chose:", computer_choice)
if user_choice == computer_choice:
print("It's a tie!")
elif user_choice == "rock" and computer_choice == "scissors":
print("You win!")
elif user_choice == "paper" and computer_choice == "rock":
print("You win!")
elif user_choice == "scissors" and computer_choice == "paper":
print("You win!")
else:
print("You lose!")
play_again = input("Do you want to play again? (y/n): ").lower()
if play_again == "y":
play_game()
else:
print("Thanks for playing!")
play_game()
Log in or sign up for Devpost to join the conversation.