def reverse(text): length = len(text) while length != 0: return text[length] length = length-1 print reverse("nidhi")
a function ends the moment a return keyword is reached
so you want to create a list/string (you choice) before loop to which append/add the letters
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.