code:
val = input('Do you want to encrypt or decrpt a message: ')
if val == "encrypt":
enr = input('Please enter a string: ')
for c in val:
if "a" <= c <= "z":
print(chr(ord("a")+(ord(c)-ord("a")+4)%26), end="")
elif "A" <= c <= "Z":
print(chr(ord("A")+(ord(c)-ord("A")+4)%26), end="")
else:
print(c, end="")
output:
Do you want to encrypt or decrypt a message: encrypt
Please enter a string: i love YOU
irgvctx
No matter what string I input, the output always becomes "irgvctx"