python reverse words and swap cases code example
Example 1: 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))
Example 2: swapping upper case and lower case string python
# swapcase() method
string = "thE big BROWN FoX JuMPeD oVEr thE LAZY Dog"
print(string.swapcase())
>>> THe BIG brown fOx jUmpEd OveR THe lazy dOG