diff --git a/Algo/B2/Exercises/Repetitive tutorial.md b/Algo/B2/Exercises/Repetitive tutorial.md index ac8a4d8..c0e3037 100644 --- a/Algo/B2/Exercises/Repetitive tutorial.md +++ b/Algo/B2/Exercises/Repetitive tutorial.md @@ -32,6 +32,18 @@ def multiplication2(x: int, y: int) -> int: # Thanks Hugo :p else return multiplication(x, y) +def productZ(x, y): + pos = True + if x < 0: + x = -x + pos = False + if y < 0: + y = -y + pos = not pos + m = multiplication(x, y) + if not pos: + m = -m + return m ``` ## Exercise 1.3