HackerRank Program on swapcase() in Python

--

link :- https://www.hackerrank.com/challenges/swap-case/problem?isFullScreen=true

Explanation :

suppose we had a string

'HackerRank.com presents "Pythonist 2".'

we need to use swapcase() function on the string in which swapcase is going to convert all lower case alphabetical letter to upper case and all upper case alphabetical letter to lower case.

def swap_case(s):
return s.swapcase()

if __name__ == '__main__':
s = input()
result = swap_case(s)
print(result)

Here we can see that how the swapcase() built-in function use on the string.

After executing the as given above we will get output

hACKERrANK.COM PRESENTS "pYTHONIST 2".

Thank you:)

#VevCodeLab

http://vevcodelab.com/

--

--