In this program, we will take a string as input and reverse the words in a string.
Steps to solve the program
- Take a string as input.
- Split the string using Split().
- Reverse the splitter string using Indexing.
- Join the reversed words using join().
- Print the output.
#Input string
string="sqatools python"
#Printing output
print(" ".join(string.split(" ")[::-1]))
Output :
python sqatools