Why is my encrypt function only returning the first translated letter? (I've cut out the decrypt and brute force -function). The issue is probably a small one but I'm new to this and I've been staring at it too long for anything to pop into my head.
import string
def encrypt(message,key):
cryptotext=""
for character in message:
if character in string.uppercase:
old_ascii=ord(character)
new_ascii=(old_ascii+key-65)%26+65
new_char=chr(new_ascii)
cryptotext+=new_char
return cryptotext
elif character in string.lowercase:
old_ascii=ord(character)
new_ascii=(old_ascii+key-97)%26+97
new_char=chr(new_ascii)
cryptotext += new_char
return cryptotext
else:
return character