RosettaCodeData/Task/Fibonacci-sequence/Python/fibonacci-sequence-17.py

4 lines
118 B
Python
Raw Permalink Normal View History

2026-02-01 16:33:20 -08:00
def fib(n):
from functools import reduce
return reduce(lambda x, y: (x[1], x[0] + x[1]), range(n), (0, 1))[0]