Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Additions solution in Scary category for Multiply (Intro) by Taytanchik
def mult_two(a, b):
sol = 0
if a and b > 0:
while a != 0:
sol += b
a -= 1
elif a and b < 0:
while a != 0:
sol += b
a += 1
elif a or b < 0:
i = min(a,b)
j = max(a,b)
while i != 0:
sol -= k
i += 1
return sol
if __name__ == '__main__':
print("Example:")
print(mult_two(3, 2))
# These "asserts" are used for self-checking and not for an auto-testing
assert mult_two(3, 2) == 6
assert mult_two(1, 0) == 0
print("Coding complete? Click 'Check' to earn cool rewards!")
Oct. 24, 2019
Comments: