I need to do a recursive function in python to return the number of the inverted form, but to be converted to string.
I just managed to do it this 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 that I could do just using whole division and rest. Does anyone help?