In this program, we will take a string as input and re-arrange the string.
Steps to solve the program
- Take a string as input.
- Convert the string into a list using Split().
- Arrange the string in the required manner.
- Convert the list into a string using join().
- Print the output.
#Input string
string = "Cricket Plays Virat"
#Converting to a list
List = string.split(" ")
List.reverse()
#Printing output
" ".join(List)
Output :
'Virat Plays Cricket'