gamee
Python
code posted
by
avi
created at 20 Jan 14:54
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
while True: player_choice = input("Enter your choice (rock, paper, scissors): ") computer_choice = random.choice(["rock", "paper", "scissors"]) print(f"Computer choice: {computer_choice}") if player_choice == computer_choice: print("It's a tie!") elif player_choice == "rock" and computer_choice == "scissors": print("You win!") elif player_choice == "paper" and computer_choice == "rock": print("You win!") elif player_choice == "scissors" and computer_choice == "paper": print("You win!") else: print("You lose!") play_again = input("Do you want to play again (yes/no)? ") if play_again.lower() != "yes": break |
720 Bytes in 3 ms with coderay