reverse a string in python using for loop