1, slice operation >>> s = "abcdefg" >>> s[::-1]
2, reduce function >>> reduce(lambda x,y:y+x,s)
3, use list >>> a=list(s) >>> a.reverse() >>> "".join(a)
No comments :
Post a Comment