online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
import random # Define the options options = ["rock", "paper", "scissors"] # Define the function to determine the winner def determine_winner(player_choice, computer_choice): if player_choice == computer_choice: return "Tie" elif player_choice == "rock" and computer_choice == "scissors": return "Player wins" elif player_choice == "paper" and computer_choice == "rock": return "Player wins" elif player_choice == "scissors" and computer_choice == "paper": return "Player wins" else: return "Computer wins" # Play the game while True: # Get the player's choice player_choice = input("Choose rock, paper, or scissors: ").lower() while player_choice not in options: player_choice = input("Invalid choice. Choose rock, paper, or scissors: ").lower() # Get the computer's choice computer_choice = random.choice(options) # Determine the winner winner = determine_winner(player_choice, computer_choice) # Print the results print(f"Player chose {player_choice}, computer chose {computer_choice}. {winner}!\n") # Ask if the player wants to play again play_again = input("Play again? (y/n): ").lower() while play_again != "y" and play_again != "n": play_again = input("Invalid choice. Play again? (y/n): ").lower() if play_again == "n": break

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue