I have a task and I am having difficulty completing it. What I did was this:
m= int(input('Digite o primeiro fator:'))
n= int(input('Digite o segundo fator:'))
def multiplica(numero):
while m > 0:
print (n + multiplica (m-1) n)
def multiplicaneg(numero):
while m < 0:
print ((-n) + multiplica (m+1) n)
if m or n == 0:
print (0)
elif m > 0:
return multiplica
else:
return multiplicaneg
What I tried was to create a function to multiply and then, at the time of printing, to return the function with the appropriate result.