0
I need to do a recursive function in python to return the number the reverse way, but be convert to string.
I could only do it that way:
import math
def inverte(num):
if(num < 10):
return num
q=num//10
q=inverte(q)
r=num%10
inv=r*10**((math.floor(math.log10(q)+1)))+q
return inv
print(inverte(1234))
However, my teacher said I could do just using whole division and rest. Someone helps?
In fact it can only have one parameter that function. That would be only the number. That way you did I already had thinking, but can only have a parameter in the function.
– Lorram RJ