fibonacci.py 153 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
#!/usr/bin/env python3

def fibonacci(n):
    if n <= 1:
        return n
    a, b = 0, 1
    for i in range(2, n+1):
        a, b = b, a+b
    return b