• + 0 comments

    My python solution

    s2 = ''
        for ch in s :
            if ch.isalpha():
                t = ord(ch)
                if 96 <= t <= 122 :
                    t += k
                    while t > 122 :
                        t -= 26
                elif 65 <= t <= 90 :
                    t += k 
                    while t > 90 :
                        t -= 26
                s2 += chr(t)
            else :
                s2 += ch
        return s2