def strReverse(string): i = 0 while i < len(string): string = string[:i] + string[-1] + string[i:-1] i += 1 return string print strReverse('abcd')