python program to switch first and second characters in a text file code example
Example: python program to switch first and second characters in a string
str = input("Enter a string : ")
new_str = str[-1:] + str[1:-1] + str[:1]
print(new_str)
str = input("Enter a string : ")
new_str = str[-1:] + str[1:-1] + str[:1]
print(new_str)