Actually, your code will break if someone enters 'z' in their input your code will break. Also, if someone enters an uppercase letter then your code will just skip that uppercase letter. You can solve these small errors by changing the input to lowercase form like this:
code = input('input text message: ')
code = code.lower()
For the second error you can add an if statement. So, whenever it faces 'z' in the input it will just specify the value of char to 'a'
You can achieve this like this
if y == x and x != " " and x !="z":
char = alphabet[alphabet.index(y) + 1]
moved += char
elif y == x and x == "z":
char = 'a'
moved +=char
If you are wondering about that moved variable then this is just a variable storing the shifted letters for example if the input is 'The' then for every iteration the shifted chracter will be added to the moved variable. And the value of moved variable will update like this
1. u
2. ui
3. uif
After the program ends you should also print this value to the console using the print statement.
print(moved)
Your code will now look like this:
import string
alphabet = list(string.ascii_lowercase)
codelist = []
moved = ""
code = input("input text message: ")
code = code.lower()
for char in code:
codelist.append(char)
for x in codelist:
for y in alphabet:
if y == x and x != " " and x !="z":
char = alphabet[alphabet.index(y) + 1]
moved += char
elif y == x and x == "z":
char = 'a'
moved +=char
print(moved)