Skip to content

Instantly share code, notes, and snippets.

@acwoss
Created May 16, 2018 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acwoss/0ad843a734c9260201c1744104db730a to your computer and use it in GitHub Desktop.
Save acwoss/0ad843a734c9260201c1744104db730a to your computer and use it in GitHub Desktop.
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