Do you want to know the information regarding “reverse the words in a string python”. If yes, you’re in the correct tutorial.
reverse the words in a string python
# in order to make a string reversed in python # you have to use the slicing as following string = "racecar" print(string[::-1])
'hello world'[::-1] 'dlrow olleh'
string = 'hello people of india' words = string.split() #converts string into list print(words[::-1])
I hope this tutorial helps you to know about “reverse the words in a string python”. If you have any questions regarding this article please let us know via the comment section. Share this tutorial with your friends & family via social networks.