Write function alternateCase which switch every letter in string from upper to lower and from lower to upper.
E.g: Hello World -> hELLO wORLD

Difficulty: introductory

Starter code:

def alternateCase(s):
	

Solutions:
def alternateCase(s):
    return s.swapcase()

alternateCase = str.swapcase

def alternateCase(s):
    return ''.join(c.swapcase() for c in s)

def alternateCase(s):
    '''
Salvador Dali - The Persistence of Memory
      ;!>,!!!>
      <! ;!!!`
      !! `!!!.
      !!`,!!!>
      !! !!!!!
     ;!! !!!!!
     `!! !!!!!
      !! !!!!!>                           .
      `!.`!!!!!                        ;<!`
       !! `!!!!                     ,<!``
       `!> !!!!                   ;<!`
       <!! !!!!>                ;!``
       !!! `!!!!               !!`                                    ,c,
       !!!> !!!!>             ;`<             ,cc$$cc            .,r== $$c !
       !!!! !!!!!!.        ,<!` !!!!!>>>;;;;;;;;.`"?$$c MMMMMMM )MM ,= "$$.`
       <!!> !!!!!!!!!!!!!>`` ,>````  ``````````!!!; ?$$c`MMMMMM.`MMMP== `$h
       `!! ;!!!!!!````.,;;;```          JF !;;;,,,,; 3$$.`MMMMMb MMMnnnM $$h
       ;!! <!!!!.;;!!!```               JF.!!!!!!!!!>`$$h `MMMMM MMMMMMM $$$
       ;!!>`!!!!!!``                    ?> !!!!!!!!!> $$$  MMMMM MMMMMMM $$$
       <!! ;!!!!`                       `h !!!!!!!!!! $$$ MMMMMM MMMM" M $$$
       `!>`!!!!                          b !!!!!!!!!! $$$ MMMMMM MMML,,`,$$$
,,,,,, ;! <!!!> ,,,,,,,,,,,,,,,,         $ !!!!!!!!!! $$$ MMMMMM MMMMML J$$F
!!!!!! !! !!!! `!!!!!!!!!!!!!!` ;        $ !!!!!!!!!! $$$ MMMMMP.MMMMMP $$$F
!!!!! ;!! !!!!> !!!!!!!!!!!!` ;` .`.`.`. ?.`!!!!!!!!! 3$$  MMMP `MMMMM>,$$P
!!!!` !!` !!!!> !!!!!!!!!!` ;!` `.`.`.`. `h !!!!!!!!! $$$  MMML  MMPPP J$$`.
!!!! !!!;!!!!!`;!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!!!!!!!!!!!!`  `.`.`.`.
!! <!!!!`;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ;! `.`.`.`.
!! ;!!!!>`!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!` <!! `.`.`.`.
`,,!!!!``.;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!` <!!! `.`.`.`.
`````.,;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!` <!!!! `.`.`.`.
;!!!!!!!!!!!!!!!!!!!!!!!>>>````````````````````<!!!!!!!!!!!` !!!!!! `.`.`.`.
!!!!!!!!!!!!!!!!!!````_,,uunmnmnmdddPPPPPPbbbnmnyy,_`````!  !!!!!!! `.`.`.`.
!!!!!!!!!``_``!``,nmMMPP"""`,.,ccccccr==pccccc,,..`""444n,.`<!!!!!! `.`.`.`.
!!!!!!!` ,dMM ,nMMP"",zcd$h.`$$$$$$$$L c  $$$$$$$$$$??cc`4Mn <!!!!! `.`.`.`.
!!!!!! ,MMMP uMMP ,d$$$$$$$$cd$F ??$$$$$cd$$$$$$$$$F, ??h.`Mx !!!!! `.`.`.`.
!!!!!! MMMP uMM",F,c ".$$$$$$$P`   ?$$$$$$$$$$$$$$$$C`,J$$.`M.`!!!! `.`.`.`.
!!!``  MMM 4MMM L`"=-z$$P".,,.    ,c$$$$$$$$$$$$$$$$$$$$$$$ ML !!!! `.`.`.`.
!!!.   `"" MMMM `$$hc$$$L,c,.,czc$$$$$$$$$$$$$$$$$$$$$$$$$$.4M `!!! `.`.`.`.
!!!!;;;..  `MMMb ?$$$$$$??""""?????????????????? ;.`$$$$$$$`JM`,!!! `.`.`.`.
!!!!!!!!!>  4MMMb."?$$$cc,.. .,,cccccccccccccccc,c`.$$$$$$$ MM <!!! `.`.`.`.
!!!!!!!!!!  `MMMMMb,."??$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$?$$$ MM ;!!! `.`.`.`.
!!!!!!!!!!    "4MMMMMMmn,."""???$$$$$$$$$$$$$$$$$$ $$$" ?$$ MP !!!! `.`.`.`.
!!!!!!!!!!!;.   "4MMMMMMMMMMMmnmn,.`"""?????$$$$$$ ?$$  `CF.M> !!!! `.`.`.`.
!!!!!!!!!!!!!!;.   `""44MMMMMMMMMMMMMMMMnnnn. ?$$$.<$$$h.$h MM !!!! `.`.`.`.
!!!!!!!!!!!!!!!!>.;.      `""444MMMMMMMMMMMMMb $$$:<$$$$$$$ 4M <!!! `.`.`.`.
!!!!!!!!!!!!!!!!!!!!!;<;);>;.     ..""""44MMMM J$`  <$$$$$$h`Mb`!!! `.`.`.`.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!>;      `MMM ?$.  d$$$$$$$ MM.`!! `.`.`.`.
!!!!!!!!!!```!``` ..``<!!!!!!!!!!!!!!!; .  MMM.<$$ <$$$$$$$$ 4Mb !! `.`.`.`.
!`````````..    ;MMMMnn.`!!!!!!!!!!!!!!! ; MMM J$$hJ$$$$$$$$h`MM !! `.`.`.`.
,xmdMMMbnmx,.    MMMMMMMr !!!!!!!!!!!!` ;: MMM $$$$$$$$$$??$$ MM !! `.`.`.`.
P"`.,,,,c`""4MMn  MMMMMMx !!!!!!!!!!!` <!: MMM $$$$$$$$L =c$F.MP !! `.`.`.`.
ub "P4MM")M,x,"4b,`44MMMP !!!!!!!!!!  !!!: MMM ???$$$$$$"=,$ JM`;!! `.`.`.`.
ML,,nn4Mx`"MMMx.`ML ;,,,;<!!!!!!!!! ;!!!!: MMM.-=,$$$$$$hc$`.MP !!! `.`.`.`.
. MMM   4Mx`MMML MM,`<!!!!!!!!!!!! ;!!!!!` `MMb  d$$$$$$$$` MM`,!!! `.`.`.`.
,d" MMn. .,nMMMM MMM `!!!!!!!!!!! ;!!!!!!>  4MMb `$$$$$$$`.dM`.!!!! `.`.`.`.
.`"M"_" MMMMMMMP,MMM ;!>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!!!!!!!!!!!!!!!!  .`.`.`.`.`.`.
;-;:>:.;`;(`;` ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!` `.`.`.`.`.`.`.
    '''
    return s.swapcase()

def alternateCase(s):
    res = ''.join([letter.lower() if letter.isupper() else letter.upper() for letter in s])
    return res

def alternateCase(s):
    ret = ""
    for c in s:
        if c.isalpha():
            if c.isupper():
                ret += c.lower()
            else:
                ret += c.upper()
        else:
            ret += c
    return ret

alternateCase = lambda s:'' if not s else f'{s[0].swapcase()}{alternateCase(s[1:])}'

def alternateCase(word):
    return word.swapcase()

def alternateCase(s):
    return ''.join(c.upper() if c.islower() else c.lower() for c in s)

alternateCase = lambda s: ''.join(i.lower() if i.isupper() else i.upper() for i in s)

def alternateCase(s):
    string = ""
    for char in s:
        if char.islower():
            string += char.upper()
        else:
            string += char.lower()
    return string


alternateCase=lambda s:list(type(s).__dict__.values())[44](s)

def alternateCase(s):
    return ''.join([x.lower() if x.isupper() else ' ' if x == ' ' else x.upper() for x in s])

def alternateCase(s):
    if len(s) < 1:
        return s
    res = ""
    for l in s:
        if l.isupper():
            res += l.lower()
        else:
            res += l.upper()
    return res

def alternateCase(s):
    res = list(s)
    count = 0
    for item in s:
        if(item.isalpha()):
            if(item.isupper()):
                res[count] = item.lower()
            else:
                res[count] = item.upper()
        count += 1
    return "".join(res)

def alternateCase(s):
    result = ""
    for letter in s:
        if letter.islower():
            result+=letter.upper()
        elif letter.isupper():
            result+=letter.lower()
        else:
            result+=letter
    
    return result

def alternateCase(s):
    #return s.swapcase() python's swapcase
    my_own_swapcase = lambda w: ''.join([l.lower() if l.isupper() else l.upper() if l.islower() else l for l in w])
    return my_own_swapcase(s)

def alternateCase(s):
    return ''.join([ch.swapcase() for ch in s])


def alternateCase(s):
    result = '';
    for i in s:
        if i.isupper():
            result += i.lower();
        elif i.islower():
            result += i.upper();
        else:
            result += ' '
    return result;


def alternateCase(s):
    copy = list(s)
    for i in range(0,len(s)):
        if(s[i].isupper()):
           copy[i] = s[i].lower()
        elif(s[i].islower()):
           copy[i] = s[i].upper()
        else:
            continue
    return ''.join(copy)

def alternateCase(s):
    a = s.swapcase()
    return a

def alternateCase(s):
    alt = ''

    for i in range(len(str(s))):
        if(s[i]).islower():
            alt += s[i].upper()
        else:
            alt += s[i].lower()

    return alt

def alternateCase(s):
    return ''.join([x.lower() if x==x.upper() else x.upper() for x in list(s) ])

from string import ascii_lowercase, ascii_uppercase

translation_table = str.maketrans(ascii_lowercase+ascii_uppercase, ascii_uppercase+ascii_lowercase)

def alternateCase(s):    
    return s.translate(translation_table)

def alternateCase(s):
    switched_str = ''
    for c in s:
        if c.islower():
            switched_str += c.upper()
        else:
            switched_str += c.lower()
    return switched_str

def alternateCase(s):
    newstring ='' 
    count1 = 0
    count2 = 0
    count3 = 0
    for a in s: 
# Checking for lowercase letter and converting to uppercase. 
        if (a.isupper()) == True: 
            count1+= 1
            newstring+=(a.lower()) 
# Checking for uppercase letter and converting to lowercase. 
        elif (a.islower()) == True: 
            count2+= 1
            newstring+=(a.upper()) 
# Checking for whitespace letter and adding it to the new string as it is. 
        elif (a.isspace()) == True: 
            count3+= 1
            newstring+= a 
    return newstring

def alternateCase(s):
    return ''.join([i.upper(), i.lower()][i.isupper()] for i in s)

def alternateCase(st):
    string = ""
    for letters in st:
        if letters.isupper():
            string += letters.lower()
        else:
            string += letters.upper()
    return string


def alternateCase(s):
    # your code here
    if s=='':
        return s
    r = ''
    for i in range(len(s)):
        if s[i].islower():
            r += s[i].upper()
        else:
            r += s[i].lower()
    return r

def alternateCase(s):

    result = ""
    for char in s:
        ascii_value = ord(char)
        if (97 <= ascii_value <= 122):
            ascii_value -= 32
        elif (65 <= ascii_value <= 90):
            ascii_value += 32

        result += chr(ascii_value)

    return result


def alternateCase(s):
    l=[]
    for i in s:
        if i == " " or i == "":
            l.append(i)
        elif i.isupper():
            l.append(i.lower())
        elif i.islower():
            l.append(i.upper())
    return "".join(l)

def alternateCase(s):
    c=""
    for i in s:
        if i.isupper():
            c+=i.lower()
        elif i.islower():
            c+=i.upper()
        else:
            c+=" "
    return c
        
            


def alternateCase(s):
    a=''
    for x in s:
        if x.islower():
            a+=x.upper()
        else: a+=x.lower()
    # your code here
    return a

def alternateCase(s):
    lst=[]
    for x in s:
        if x.islower():
            lst.append(x.upper())
        elif x.isupper():
            lst.append(x.lower())
        else:
            lst.append(x)
    x = "".join(lst)
    return x

def alternateCase(s):
    ret = ''
    for c in s:
        if c.isupper():
            ret += c.lower()
        elif c.islower():
            ret += c.upper()
        else:
            ret += c
    return ret

def alternateCase(s):
    
    string = ""
    
    for i in s:
        if i.isupper():
            i = i.lower()
            string += i
        else:
            i = i.upper()
            string += i
            
    return string

def alternateCase(s):
    string = ""
    for letter in s:
        if letter == letter.upper():
            letter = letter.lower()
            string = string + letter
        else:
            letter = letter.upper()
            string = string + letter
            
    return string

def alternateCase(s):
    new=""
    for i in range(len(s)):
        if s[i].islower():
            new+=s[i].upper()
        if s[i].isupper():
            new+=s[i].lower()
        if s[i]==" ":
            new+=" "
    return new

def alternateCase(s):
    myList = []
    
    for i in s:
        if i.isupper():
            myList.append(i.lower())
        elif i.islower():
            myList.append(i.upper())
        else:
            myList.append(i)
            
    return ''.join(myList)

def alternateCase(s):
    nw = ''
    for i in s:
        if i.isupper():
            nw += i.lower()
        else:
            nw += i.upper()
    return nw

def alternateCase(s):
    a = ""
    for x in s:
        if x.isupper():
            a += x.lower()
        elif x.islower():
            a += x.upper()
        elif x == " ":
            a += " "
    return a

alternateCase = lambda s : ''.join([x.lower() if x.isupper() else x.upper() for x in s])

def alternateCase(s):
    new_upper = s.upper()
    print(s)

    new_sent = []

    for i in range(0, len(s)):
        if s[i] == " ":
            print(True)
            new_sent.append(" ")
        elif s[i] != new_upper[i]:
            print("Needs upper")
            new_sent.append(s[i].upper())
        else:
            print("Needs lower")
            new_sent.append(s[i].lower())
    print(new_sent)
    answer = "".join(new_sent)
    print(answer)
    return answer

def alternateCase(s):
    a = []
    for i in s:
        if i.isupper():
            a.append(i.lower())
        else:
            a.append(i.upper())
    return ''.join(a)

def alternateCase(s=''):
    # your code here
    print(s)
    listl = list(s)
    n = len(s)
    i = 0
    while i < n:
        if s[i].isupper() == True:
            print(s[i])
            letra = s[i].lower()
            print(letra)
            listl[i] = letra
            print(listl)
            s = ''.join(listl)
            print(s)
        
        else:
            if s[i].islower() == True:
                print(s[i])
                letra = s[i].upper()
                print(letra)
                listl[i] = letra
                print(listl)
                s = ''.join(listl)
                print(s) 
        i += 1
    return s

def alternateCase(s):
    k=""
    for x in s:
        if x in "qwertyuioplkjhgfdsazxcvbnm":
            k=k+x.upper()
        elif x in "QWERTYUIOPASDFGHJKLZXCVBNM":
            k=k+x.lower()
        else:
            k=k+x
        
        
    return k

def alternateCase(s):
    w = ''
    for i in s:
        if i.isupper() == True:
            w += i.lower()
        else:
            w += i.upper()
    return w


def alternateCase(s):
    result=""
    for letter in s:
        if letter.isupper():
            result+=letter.lower()
        else:
            result+=letter.upper()
    return result

def alternateCase(string):
    # your code here
    res = ''
    for char in string:
        if char.lower() == char:
            res += char.upper()
        else:
            res += char.lower()
    return res

def alternateCase(s):
    listW = list(s)
    for i in range(len(listW)):
        if listW[i].islower():
            listW[i]=listW[i].upper()
        elif listW[i].isupper():
            listW[i]=listW[i].lower()
    return ''.join(listW)

def alternateCase(s):
    # your code here
    return ''.join([char.swapcase() for char in s])

def alternateCase(s):
    s = list(s)
    for x in range(len(s)):
        if s[x] == s[x].upper():
            s[x] = s[x].lower()
        else:
            s[x] = s[x].upper()
    return ''.join(s)

def alternateCase(s=''):
    msg = ''
    if s == '':
        return ''
    for i in s:
        if i.islower():
            msg = msg + str(i.upper())
        elif i.isupper():
            msg = msg + str(i.lower())
        else:
            msg = msg + str(i)
    return msg

def alternateCase(s):
    # your code here
    
    return ''.join([c.swapcase() for c in s])

def alternateCase(s):
    s=str(s)
    ergebnis=''
     
    for letter in s:
        if letter.isupper():
            ergebnis+=letter.lower()
        else:
            ergebnis+=letter.upper()
            
        
            
    return ergebnis

def alternateCase(s):
    news=[]
    for i in range(len(s)):
        if s[i].islower():
            news.append(s[i].upper())
        else:
            news+=s[i].lower()
    return(''.join(news))


def alternateCase(s):
    res = ""
    for c in s:
        if c.isupper():
            res+=c.lower()
        else:
            res+=c.upper()
    return res

def alternateCase(s):
#     for el in s:
#         if el.isupper(): 
#             s.replace(el, el.lower())
#         elif el.islower(): 
#             s.replace(el, el.upper()) 
    
    return s.swapcase()

def alternateCase(s):
    S=""
    for i in s:
        if i.isupper():
            S+=i.lower()
        else:
            S+=i.upper()
        
    return S

def alternateCase(s):
    output = ""
    for c in s:
        if c.isupper():
            output += c.lower()
        else: 
            if c.islower():
                output+= c.upper()
            else:
                output += c

    return output

def alternateCase(s):
    ret = ''
    for x in s:
        if x == x.upper():
            ret+=x.lower()
        else:
            ret+=x.upper()
    return ret

def alternateCase(s):
    
    return "".join(c.upper() if c==c.lower() else c.lower() for c in s)

def alternateCase(s):
    n_s=''
    if s.isspace():
        return s
    for i in s:
        if i.isupper():
            n_s+=i.lower()
        elif i.lower():
            n_s+=i.upper()
        else:
            n_s+=i
    return n_s            

def alternateCase(s):
    new_s = ""
    for ltr in s:
        if ltr.lower() == ltr:
            ltr = ltr.upper()
        else:
            ltr = ltr.lower()
        new_s += ltr
    return new_s

def alternateCase(s):
    new_string = ""
    for a in s: 
        if (a.isupper()) == True: 
            new_string += (a.lower()) 
        elif (a.islower()) == True: 
            new_string += (a.upper()) 
        elif (a.isspace()) == True: 
            new_string += a 
    return new_string

def alternateCase(s):
    # your code here
    res=''
    for i in range(len(s)):
        if s[i]>='a' and s[i]<='z':
            res=res+s[i].upper()
        elif s[i]>='A' and s[i]<='Z':
            res=res+s[i].lower()
        else:
            res=res+s[i]
    return res

def alternateCase(s):
    return ''.join(c.lower() if str.isupper(c) else c.upper() for c in s)

def alternateCase(s):
    result = ''
    if len(s) == 0 or s == ' ':
        return s
    for letter in s:
        if 'a' <= letter <= 'z':
            result += letter.upper()
        elif 'A' <= letter <= 'Z':
            result += letter.lower()
        else:
            result += letter
    return result

def alternateCase(s):
    res = ''
    for i in [i for i in s]:
        if i.isupper() == True:
            res = res + i.lower()
        else:
            res = res + i.upper()
    return res

def alternateCase(s):
    lst = []
    for i in s:
        if i == i.upper():
            lst.append(i.lower())
        else:
            lst.append(i.upper())
    return ''.join(lst)


def alternateCase(s):
    stringy = ''
    for i in s:
        if i.islower():
            stringy += i.upper()
        elif i.isupper():
            stringy += i.lower()
        else:
            stringy += i
    return stringy

def alternateCase(s):
    string = ''
    for i in s:
        print(i)
        if i == i.upper():
            string += i.lower()
        else:
            string += i.upper()
    return string

def alternateCase(s):
    # a - z = 97 - 122
    # A - Z = 65 - 90
    # your code here
    new_s = ''
    for char in s:
        if ord(char) > 122 or ord(char) < 65:
            new_s += char
            continue
        if ord(char) >= 97:
            new_s += chr(ord(char) - 32)
        else:
            new_s += chr(ord(char) + 32)
    return new_s

def alternateCase(s):
    final = []
    for l in s:
        if l == l.lower():
            final.append(l.upper())
        elif l == l.upper():
            final.append(l.lower())
        else:
            final.append(' ')
        
    return ''.join(final)

def alternateCase(s):
    cout = []
    
        
    for letter in s:
        if letter == letter.upper():
            cout.append(letter.lower())
        elif letter == letter.lower():
            cout.append(letter.upper())
    return "".join(cout)

import string


def alternateCase(s):
    # your code here
    UPPER = string.ascii_uppercase
    LOWER = string.ascii_lowercase
    
    result = []
    for letter in s:
        if letter in UPPER:
            result.append(letter.lower())
        else:
            result.append(letter.upper())
    return ''.join(result)

def alternateCase(s):
    k = ''
    for i in s:
        if i.islower():
            k += i.upper()
        elif i.isupper():
            k += i.lower()
        else:
            k += i
    return k

def alternateCase(s):
    new = ""
    for let in s:
        if let.isupper():
            new+=let.lower()
        elif let.islower():
            new+=let.upper()
        else:
            new+=let
    return new

from string import ascii_uppercase as u, ascii_lowercase as l
def alternateCase(s):
    # your code here
    return s.translate(str.maketrans(u+l,l+u))


def alternateCase(s):
    alt = ""
    for i in s:
        if i.isupper():
            alt += i.lower()
        else:
            alt += i.upper()
    return alt

a = ord('a')
A = ord('A')
z = ord('z')
Z = ord('Z')
upperToLower = A-a
lowerToUpper = a-A

def alternateCase(s):
    str = ""
    for i in range(len(s)):
        if ord(s[i]) >= A and ord(s[i]) <= Z:
            # convert to lower case
            str += chr(ord(s[i]) - upperToLower)
        elif ord(s[i]) >= a and ord(s[i]) <= z:
            # convert to upper case
            str += chr(ord(s[i]) - lowerToUpper)  
        else:
            str += s[i]
    return str

def alternateCase(s):
    return ''.join([l.upper() if l.islower() else l.lower() for l in s])
            
        


def alternateCase(s):
    new_text=''
    for i in s:
        if i.islower():
            new_text+=i.upper()
        else:
            new_text+=i.lower()
    return new_text

def alternateCase(s):
    s = [letter for letter in s]
     
    for i in range(len(s)):
        if s[i] == s[i].upper():
            s[i] = s[i].lower()
        
        else: 
            s[i] = s[i].upper()
            
    return "".join(s)

def alternateCase(s):
    text = ""
    for i in s:
        if i.islower():
            text += i.upper()
        else:
            text += i.lower()
    return text

def alternateCase(s):
    # your code here
    
    alternated = []
    
    for i in list(s):
        
        if i.isspace():
            alternated.append(i)
        
        if i.islower():
            alternated.append(i.upper())
        
        if i.isupper():
            alternated.append(i.lower())
    
    return  "".join(alternated)

def alternateCase(s):
    res = ""
    for c in s:
        res += c.upper() if c.islower() else c.lower()
    return res


def alternateCase(s):
    new_s=[]
    for char in s:
        if char.isupper():
            new_s.append(char.lower())
        else:
            new_s.append(char.upper())
            
    return "".join(new_s)

def alternateCase(s):
    s_list = s.split()
    new_s=[]
    for char in s:
        if char.isupper():
            new_s.append(char.lower())
        else:
            new_s.append(char.upper())
    
    new_s_string = "".join(new_s)
            
    return new_s_string

def alternateCase(s):
    final_ans=""
    tokens = [c for c in s]
    for c in tokens:
        if c.isupper():
            final_ans= final_ans+c.lower()
        else:
            final_ans = final_ans+c.upper()
    return final_ans

def alternateCase(s):
    upper_letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    lower_letters = list(upper_letters.lower())
    upper_letters = list(upper_letters)
    
    ans = ''
    index = 0

    while index < len(s):
        char = s[index]
        if char == '' or char == ' ':
            ans += char
            index += 1
            continue
        
        if char in upper_letters:
            ans += char.lower()
        
        if char in lower_letters:
            ans += char.upper()
            
        index += 1

    return ans

def alternateCase(s):
    # your code here
    res = ""
    
    for c in s:
        if c.isupper():
            res += c.lower()
        elif c.islower():
            res += c.upper()
        else:
            res += c
    return res

def alternateCase(s):
    return ''.join(l.lower() if l.isupper() else l.upper() for l in s)

def alternateCase(s):
    s = [x.upper() if x.islower() else x.lower() for x in s]
    s = "".join(s)
    return s

def alternateCase(s):
    return "".join([l.upper() if l.islower() else l.lower() if l.isupper() else l for l in s])

def alternateCase(s):
    text=''
    for i in range(len(s)):
        if s[i].isupper() == True:
            text = text + s[i].lower()
        else:
            text = text + s[i].upper()
    return text

def alternateCase(s):
    a = s
    b = ''
    for i in range(len(a)):
        if str.isupper(a[i]):
            b += a[i].lower()
        elif a[i] == ' ':
            b += ' '
        else:
            b += a[i].upper()
    return b

def alternateCase(s):
    if len(s) == 0: return s
    res = []
    for x in s:
        if x.isupper(): res.append(x.lower())
        elif x.islower(): res.append(x.upper())
        else: res.append(x)
    return "".join(res)

def alternateCase(s):
    ans = ''
    for c in s:
        if c.upper() == c:
            ans += c.lower()
        elif c.lower() == c:
            ans += c.upper()
    return ans

def alternateCase(s):
    lst=list()
    for i in s:
        if i.isupper():
            lst.append(i.lower())
        elif i.islower():
            lst.append(i.upper())
        else:
            lst.append(" ")
    return "".join(lst)