Answers for "how to reverse word order in python"

6

how to reverse word order in python

## initializing the string
string = "I am a python programmer"
## splitting the string on space
words = string.split()
## reversing the words using reversed() function
words = list(reversed(words))
## joining the words and printing
print(" ".join(words))
Posted by: Guest on June-11-2020

Code answers related to "how to reverse word order in python"

Python Answers by Framework

Browse Popular Code Answers by Language