This is the simplest code for reversing a string text.
Though it is very simple, i don't understand the logic behind it, could someone help explain it please?
The main line of code that needs explanation is: result = i + result
Thanx in advance...
def reverse(text): result = "" for i in text: result = i + result return result