MapleStory Finger Point

πŸ’Ž Python/Python_Code

λŒ€μ†Œλ¬Έμž μƒν˜Έ λ³€ν™˜ν•˜κΈ° - 파이썬 for Beginner (2판)

HYEJU01 2024. 3. 28. 04:16

 

 

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)