The function we ended up with is show below.
def n_paths(start=1, end=5, jumps=(1, 2)):
if start > end:
return 0
if start == end:
return 1
return npaths(start=start + 1, end=end) + npaths(start=start + 2, end=end)
recursion: function
The function we ended up with is show below.
def n_paths(start=1, end=5, jumps=(1, 2)):
if start > end:
return 0
if start == end:
return 1
return npaths(start=start + 1, end=end) + npaths(start=start + 2, end=end)