INPUT THIS INTO RAPTOR FOR ME WITH SCREENSHOT OF PROGRAM START FUNCTION get_user_choice(): WHILE True DO PRINT "Enter your choice: (R)ock, (P)aper, or (S)cissors" user_choice = INPUT().lower() IF user_choice in ['r', 'p', 's'] THEN RETURN user_choice ELSE PRINT "Invalid input! Please enter R, P, or S." FUNCTION get_computer_choice(): choices = ['r', 'p', 's'] RETURN RANDOM.choice(choices) FUNCTION determine_winner(user, computer): IF user == computer THEN RETURN "It's a tie!" ELSE IF (user == 'r' and computer == 's') OR (user == 's' and computer == 'p') OR (user == 'p' and computer == 'r') THEN RETURN "You win!" ELSE RETURN "Computer wins!" FUNCTION play_game(): WHILE True DO user_choice = get_user_choice() computer_choice = get_computer_choice() PRINT "You chose:", user_choice PRINT "Computer chose:", computer_choice result = determine_winner(user_choice, computer_choice) PRINT result PRINT "Do you want to play again? (y/n):" play_again = INPUT().lower() IF play_again != 'y' THEN PRINT "Thanks for playing!" BREAK CALL play_game() END
INPUT THIS INTO RAPTOR FOR ME WITH SCREENSHOT OF PROGRAM
START
FUNCTION get_user_choice():
WHILE True DO
PRINT "Enter your choice: (R)ock, (P)aper, or (S)cissors"
user_choice = INPUT().lower()
IF user_choice in ['r', 'p', 's'] THEN
RETURN user_choice
ELSE
PRINT "Invalid input! Please enter R, P, or S."
FUNCTION get_computer_choice():
choices = ['r', 'p', 's']
RETURN RANDOM.choice(choices)
FUNCTION determine_winner(user, computer):
IF user == computer THEN
RETURN "It's a tie!"
ELSE IF (user == 'r' and computer == 's') OR (user == 's' and computer == 'p') OR (user == 'p' and computer == 'r') THEN
RETURN "You win!"
ELSE
RETURN "Computer wins!"
FUNCTION play_game():
WHILE True DO
user_choice = get_user_choice()
computer_choice = get_computer_choice()
PRINT "You chose:", user_choice
PRINT "Computer chose:", computer_choice
result = determine_winner(user_choice, computer_choice)
PRINT result
PRINT "Do you want to play again? (y/n):"
play_again = INPUT().lower()
IF play_again != 'y' THEN
PRINT "Thanks for playing!"
BREAK
CALL play_game()
END
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images