링크

 

def caesarCipher(s, k):
    # 65~90 A to Z , 97 ~ 122 : a to z  ord()
    res = []
    asciiCode = 0
    for i in s:
        if (ord('A') <= ord(i) and  ord(i) <= ord('Z')) : # upper  case
            asciiCode = ord(i)+k
            while asciiCode > ord('Z'):
                asciiCode -= 26
            
        elif(ord('a') <= ord(i) and   ord(i) <= ord('z') ) :    # lower case
            asciiCode = ord(i)+k
            while asciiCode > ord('z'):
                asciiCode -= 26
                
        else: asciiCode = ord(i)

        res.append(chr(asciiCode))
    return (''.join(res))
블로그 이미지

hjc_

୧( “̮ )୨

,