Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Readable version solution in Clear category for Follow Instructions by new_hoschi
def follow(instructions):
## I know that there is space to save code lines, but I like the way it is
values=('f','b','l','r')
## count the number of steps in each direction
steps={step:instructions.count(step) for step in values}
## simply recap the number of steps in every direction
return (steps['r']-steps['l'],steps['f']-steps['b'])
April 15, 2020
Comments: