Tell us what’s happening:
Describe your issue in detail here.
Your code so far
def player(prev_play, opponent_history=):
opponent_history.append(prev_play)
guess = ‘R’
if len(opponent_history) > 5:
guess = opponent_history[-3]
if opponent_history[-3] ==opponent_history[-1]:
if opponent_history[-1]== 'R':guess='P'
elif opponent_history[-1]== 'S':guess='R'
elif opponent_history[-1]== 'P':guess='S'
if opponent_history[-6:-3] ==opponent_history[-3:]:
if opponent_history[-1]== 'R':guess='S'
elif opponent_history[-1]== 'S':guess='P'
elif opponent_history[-1]== 'P':guess='R'
return guess
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
Challenge: Machine Learning with Python Projects - Rock Paper Scissors
Link to the challenge: