Title / Description
Code 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
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code