Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Follow Instructions by l.szyman10
def follow(instructions):
pos = [0,0]
moves = {'f':(0,1),'b':(0,-1),'l':(-1,0),'r':(1,0)}
for m in instructions:
pos[0]+=moves[m][0]
pos[1]+=moves[m][1]
return tuple(pos)
May 14, 2020