vault backup: 2023-11-24 16:02:14
This commit is contained in:
parent
68295d1f23
commit
65c850800c
@ -160,7 +160,7 @@ def mu_sum(n: int) -> int:
|
||||
```python
|
||||
def euclid(a, b):
|
||||
if (a <= b):
|
||||
raise ValueError("a must be superior to b")
|
||||
raise Exception("a must be superior to b")
|
||||
r = 1
|
||||
while r != 0:
|
||||
oldr = r
|
||||
@ -176,3 +176,24 @@ def euclid(a, b):
|
||||
(a, b) = (b, a%b)
|
||||
return a
|
||||
```
|
||||
|
||||
## Exercise 2.2
|
||||
```python
|
||||
def mirror(n: int) -> int;
|
||||
res = 0
|
||||
while n != 0:
|
||||
res = res * 10 + n % 10
|
||||
n //= 10
|
||||
return res
|
||||
```
|
||||
|
||||
## Exercise 3.3
|
||||
```python
|
||||
def quotient(a: int, b: int) -> int:
|
||||
q = 0
|
||||
if (a < b):
|
||||
(a, b) = (b, a)
|
||||
while (a-b) >= 0:
|
||||
q += 1
|
||||
a -= b
|
||||
return q
|
||||
|
Loading…
x
Reference in New Issue
Block a user