vault backup: 2023-11-24 14:22:03

This commit is contained in:
2023-11-24 14:22:03 +01:00
parent 95d5b547dc
commit aed37bf953
2 changed files with 37 additions and 5 deletions

View File

@ -72,3 +72,35 @@ def power(x, n):
n -= 1
return res
```
## 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
```
## Exercise 1.5
```python
def my_sum(n: int) -> int:
s = 0
i = 1
while i <= n:
s += u(i)
i += 1
return s
def my_sum(n: int) -> int:
s = 0
while n > 0:
s += u(n)
n -= 1
return s