Skip to content

Instantly share code, notes, and snippets.

@samartioli
samartioli / gist:5314204
Last active December 15, 2015 19:49
Python solution to problem: "A person can walk/hop 1, 2 or 3 steps at a time, find all the possible ways to walk/hop down n steps"
def append_return(n,L):
M=L[:]
M.append(n)
return M
def steps(n, L=[]):
if n == 0:
print L
if n >= 1:
steps(n-1, append_return(1,L))