

def alphabet_position(letter):
    alphabet = {'A':0, 'a':0, 'B':1, 'b':1, 'C':2, 'c':2, 'D':3, 'd':3, 'E':4, 'e':4, 'F':5, 'f':5, 'G':6, 'g':6, 'H':7, 'h':7, 'I':8, 'i':8, 'J':9, 'j':9, 'K':10, 'k':10, 'L':11, 'l':11, 'M':12, 'm':12, 'N':13, 'n':13, 'O':14, 'o':14, 'P':15, 'p':15, 'Q':16, 'q':16, 'R':17, 'r':17, 'S':18, 's':18, 'T':19, 't':19, 'U':20, 'u':20, 'V':21, 'v':21, 'W':22, 'w':22, 'X':23, 'x':23, 'Y':24, 'y':24, 'Z':25, 'z':25}
    pos = alphabet[letter]
    return pos
	
def rotate_character(char, rot):
    if 'a' <= char <= 'z':
        new_ord = ord(char) + rot
        if new_ord > ord('z'):
            new_ord = new_ord - 26
    elif 'A' <= char <= 'Z':
        new_ord = ord(char) + rot
        if new_ord > ord('Z'):
            new_ord = new_ord - 26
    else:
        new_ord = ord(char)
    return chr(new_ord)
	
def encrypt(text, rot):
    encrypted = []
    for char in text:
        if char.isalpha():
            encrypted.append(rotate_character(char,rot))
        else: 
            encrypted.append(char)
    return ''.join(encrypted)