• syntax error


I would like to give some feedback about syntax error, that should not appear in line (if "POP" in i:)

def letter_queue(commands):

r = []

for i in commands:
    if "PUSH" in i:
        r.append(i.replace("PUSH ","")
    if "POP" in i:
        if len(r)>0:

return "".join(r)

From: http://www.checkio.org/mission/letter-queue/solve/


Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36