Monday, June 1, 2020

upper case and lower case conversion in python

def swap_case(s):
    a = ""
    for i in s:
        if i.isupper() == True:
            a+=(i.lower())
        else:
            a+=(i.upper())
    return a
    

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

No comments:

Post a Comment

python class topic video