AncientAustereArchitect created by acwoss - https://repl.it/@acwoss/AncientAustereArchitect
def multiply(a, b): | |
result = sum(b for _ in range(abs(a))) | |
return result if a > 0 else -result | |
print(multiply(2, 5)) | |
print(multiply(-2, -5)) | |
print(multiply(-2, 5)) | |
print(multiply(2, -5)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment