I am practicing w/ Python and wanted to code a simple Rock, Paper, Scissors game w/o any user input. I used a list to hold the values and randomly pulled them with a function. I used the the return value from the first function to print the response in the second function, along with the printed results. What are some alternative methods to achieve this same functionality and make this more efficient. Thank you.
# Internal Rock, Paper Scissors Game >>>>>>>>>>>>>>>>>>>>>>>>>
import random
# List string values for the game
r_p_s = [
'Rock', 'Paper', 'Scissors'
]
# Function to return random values from List
def game():
return random.choice(r_p_s) + " vs. " + random.choice(r_p_s)
result = game() # Returned Value
# Function to print out the results of the returned value with a response
def response():
print("Roll: " + "\n" + result)
if "Scissors vs. Paper" == result or \
"Paper vs. Scissors" == result:
print("\nScissors beats Paper")
elif "Scissors vs. Rock" == result or \
"Rock vs. Scissors" == result:
print("\nRock beats Scissors!")
elif "Rock vs. Paper" == result or \
"Paper vs. Rock" == result:
print("\nPaper beats Rock!")
else:
print("\nDraw! Roll again.")
response()