# Allison Obourn
# CSC 110, Spring 2018
# Lecture 15

# prompts the user for a secret phrase and
# a key and outputs the outputs the phrase
# with each letter shifed over key amount.
# Ignores non-alphabetic characters

def main():
    message = input("Message? ")
    message = message.lower()
    key = int(input("Key? "))

    for i in range(len(message)):
        character = message[i]
        if ord("a") <= ord(character) <= ord("z"):
            char_num = ord(character)
            char_num = char_num + key
            if char_num > ord("z"):
                char_num = char_num - 26
            new_character = chr(char_num)
            print(new_character, end="")
        else:
            print(character, end="")

main()
