Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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))
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #reverse #word #order #python
ADD COMMENT
Topic
Name
8+7 =