python program to switch first and second characters in a string

Solutions on MaxInterview for python program to switch first and second characters in a string by the best coders in the world

showing results for - "python program to switch first and second characters in a string"
Debora
17 Aug 2016
1str = input("Enter a string : ")
2new_str = str[-1:] + str[1:-1] + str[:1]
3print(new_str)