vault backup: 2023-11-24 14:33:51

This commit is contained in:
Louis Gallet 2023-11-24 14:33:51 +01:00
parent fd79eb30a2
commit 601e9f0dd6
Signed by: lgallet
SSH Key Fingerprint: SHA256:qnW7pk4EoMRR0UftZLZQKSMUImbEFsiruLC7jbCHJAY

View File

@ -76,17 +76,15 @@ def power(x, n):
## Exercise 1.4
```python
def fibo(n: int) -> int:
a = 0
b = 1
c = 0
i = 2
while i <= n:
c = a + b
a = b
b = c
i += 1
return b
def fibo(n):
prev = 1 #f0
cur = 1 #f1
while n> 1:
(prev, cur) = (cur, prev+cur)
n -= 1
return cur
# OR
```
## Exercise 1.5