I am trying to encode and then decode this function in python using cipher encryption. I wrote this function. how do I change this function so that it encodes both lower and uppercase letters?
def encrypt(message, key):
alphabet="abcdefghijklmnopqrstuvwxyz"
encMessage=""
for character in message:
if character in alphabet:
index = alphabet.find(character)
newPosition = (index+key)%26
newCharacter = alphabet[newPosition]
encMessage+=newCharacter
else:
encMessage+=character
return encMessage