vault backup: 2023-11-20 13:43:12
This commit is contained in:
parent
26b0afcfb8
commit
f638273eed
@ -17,8 +17,9 @@ The function return the sum of the factorial of n
|
||||
```
|
||||
def multiplication(x: int, y: int) -> int:
|
||||
result = 0
|
||||
for i in range(y):
|
||||
result = result + x
|
||||
while y > 0:
|
||||
m += x
|
||||
y -= 1
|
||||
return result
|
||||
|
||||
def multiplication2(x: int, y: int) -> int:
|
||||
@ -44,6 +45,14 @@ def multiplication2(x: int, y: int) -> int:
|
||||
result = result + x
|
||||
i += 1
|
||||
return result
|
||||
|
||||
def multiplication2(x: int, y: int) -> int:
|
||||
if x < 0 and y < 0:
|
||||
return multiplication(-x, -y) * (-1)
|
||||
elif y < 0:
|
||||
return multiplication(x, -y) * (-1)
|
||||
else
|
||||
return multiplication(x, y)
|
||||
```
|
||||
|
||||
## Exercise 1.3
|
||||
|
Loading…
x
Reference in New Issue
Block a user