Thursday, 15 June 2017

How to use Python string swapcase() Method | Softcrayons IT Training Tutorial

swapcase()method
returns a string in which all the case are swapped based on their
characters. It goes not take any arguments remember that.


Syntax


str.swapcase()





Examples


str= “hello to this new world”


printstr.swapcase()





str=”HELLO TO THIS NEW WORLD”


printstr.swapcase()





str=”Hello to This new World”


printstr.swapcase()


When we run our program we will see following output on our console


HELLO TO THIS NEW WORLD


hello to this new world


hEELO TO tHIS NEW wORLD










Updated: June 9, 2017 at 12:40 pm


How to use Python string swapcase() Method | Softcrayons IT Training Tutorial

No comments:

Post a Comment