reverse a string in python without using inbuilt function