swapcase() μ¬μ©νμ§ μκ³ λ³ννλ μ½λλ€.
lower κ³Ό upper μ λ¬Έμ νλμ© μΆμΆν΄μ λ³νν΄μΌνλ€.
쑰건문μ ν΅ν΄ λλ¬Έμλ©΄ lower
μλ¬Έμλ©΄ upper κ° μ€νλλλ‘ νλ€.
λμλ¬Έμλ μλλ©΄ κ·Έλλ‘ μΆλ ₯.
inStr, outStr = "", ""
ch = ""
count, i = 0,0
if __name__ == "__main__" :
inStr = input("λ¬Έμμ΄ μ
λ ₯ =>")
count = len(inStr)
for i in range (0,count) :
ch = inStr[i]
if (ord(ch)>=ord("A") and ord(ch) <=ord("Z")):
newCh = ch.lower()
elif (ord(ch)>=ord("a") and ord(ch) <=ord("z")):
newCh = ch.upper()
else :
newCh = ch
outStr += newCh
print("λμλ¬Έμ λ³ν κ²°κ³Ό --> %s" % outStr)