Wed Aug 10 2022 08:37:28 GMT+0000 (Coordinated Universal Time)
Saved by @redpsych
from functools import reduce fibSequence = lambda n: reduce(lambda x, _: x+[x[-1]+x[-2]], range(n-2), [0, 1]) print(fibSequence(10)) print(fibSequence(5)) print(fibSequence(6))
Copy this HTML code:
Preview:
open_in_newInstructions on embedding in Medium
Comments