vault backup: 2023-11-13 14:23:48

This commit is contained in:
Louis Gallet 2023-11-13 14:23:48 +01:00
parent e8d7b7a7fe
commit bda881d852
Signed by: lgallet
SSH Key Fingerprint: SHA256:qnW7pk4EoMRR0UftZLZQKSMUImbEFsiruLC7jbCHJAY

View File

@ -8,6 +8,34 @@ def sum_digits (n: int) -> int:
b = (n//10)%10 b = (n//10)%10
c = n%10 c = n%10
return (a+b+c) return (a+b+c)
def product_digits (n):
a = n//10
b = (n//10) % 10
c = n % 10
return (a*b*c)
def abs (n):
if n > 0:
return n
else:
return (-1)*n
def loop (n):
n = abs(n)
if (sum_digits(n) == product_digits(n)):
return n
else
return loop(n+1)
``` ```
## Exercise 2: ## Exercise 2:
```python
def max3 (x: int, y: int, z: int) -> int:
if ((x > y) and (x > z)):
m = x
elif ((y > x) and (y > z)):
m = y
elif ((z > x) and (z > y)):
m = z
return m