| Author | R K | 
| Submission date | 2019-06-10 20:54:07.207082 | 
| Rating | 5370 | 
| Matches played | 239 | 
| Win rate | 53.97 | 
Use rpsrunner.py to play unranked matches on your computer.
import random as rm
inputList = []
if input == "": # initialize variables for the first round
    output = rm.choice(['P','S','R'])
else:
    inputList.append(input)
    n = len(inputList)
    if n > 2:
        last = inputList[-1]
        secondLast = inputList[-2]
        if(last == secondLast == "R"):
            output = "P"
        elif(last == secondLast == "P"):
            output = "S"
        elif(last == secondLast == "S"):
            output = "R"
        elif(secondLast == "R" and last == "P"):
            output = "S"
        elif(secondLast == "P" and last == "R"):
            output = "P"    
        elif(secondLast == "P" and last == "S"):
            output = "R"
        elif(secondLast == "S" and last == "P"):
            output = "S"
        elif(secondLast == "S" and last == "R"):
            output = "P"
        elif(secondLast == "R" and last == "S"):
            output = "R"
        else:
            output = rm.choice(['P','S','R'])
    else:
        output = rm.choice(['P','S','R'])