SahanaShreeN / CODSOFT_4

CODSOFT task4.The task is rock-paper-scissors game.
3 stars 0 forks source link

Sudhajaganathan #1

Open sudhajaganthan opened 1 week ago

sudhajaganthan commented 1 week ago

import random

options = ("rock", "paper", "scissors") winning = ("scissors", "rock", "paper") running = True

while running:

player = None
computer = random.choice(options)

while player not in options:
    player = input("Enter a choice (rock, paper, scissors): ").lower()

print(f"Player: {player}")
print(f"Computer: {computer}")

if player == computer:
    print("It's a tie!")
elif options.index(player) == winning.index(computer):
    print("You win !")
else:
    print("You lose!")

if not input("Play again? (y/n): ").lower() == "y":
    running = False

print("Thanks for playing!")

sudhajaganthan commented 1 week ago

Hii