Files
RustPython/tests/benchmarks/perf_fib.py
Daniel Watkins 2a52a15fa6 Restore perf_fib to being tested
We now have a range function that is sufficient for its purposes.
2018-08-04 16:26:06 -04:00

18 lines
225 B
Python

def fib(n):
# a, b = 1, 1
a = 1
b = 1
for _ in range(n-1):
temp = b
b = a+b
a = temp
#a, b = b, a+b
return b
print(fib(1))
print(fib(2))
print(fib(3))
print(fib(4))
print(fib(5))