Wednesday, May 31, 2017

sWAP cASE

You are given a string S. The task is to Swap Cases. In other words, convert all lowercase letters to uppercase letters and vice versa.
For Example:
Www.HackerRank.com → wWW.hACKERrANK.COM
Pythonist 2 → pYTHONIST 2
Input Format
A single line containing a string S.
Output Format
Print the modified string S.

Solution:

def swap_case(s):
    a = s.swapcase()
    return a
b = input()
print(swap_case(b))

Share: