You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
def multiply(x, y):
|
|
if y < 0:
|
|
return -multiply(x, -y)
|
|
elif y == 0:
|
|
return 0
|
|
elif y == 1:
|
|
return x
|
|
else:
|
|
return x + multiply(x, y - 1)
|
|
|
|
print(multiply(3, 5)); |