mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
17 lines
197 B
Python
17 lines
197 B
Python
def fib(n):
|
|
a = 1
|
|
b = 1
|
|
for _ in range(n - 1):
|
|
temp = b
|
|
b = a + b
|
|
a = temp
|
|
|
|
return b
|
|
|
|
|
|
print(fib(1))
|
|
print(fib(2))
|
|
print(fib(3))
|
|
print(fib(4))
|
|
print(fib(5))
|