In this program, we will take a string as input and exchange first & last letters of the string
Steps to solve the program
- Take a string as input.
- Exchange the first and last letters of the string using Indexing.
- Print the output.
#Input string
string1= "We are learning python"
#Printing output
print(string1[-1]+string1[1:-1]+string1[0])
Output :
ne are learning pythoW