I'm trying to make a program which takes a word or sentence, and then shifts each character one place in the alphabet. This is my minimal reproducible example:
alphabet = []
alphabet = [chr(x) for x in range(ord('a'), ord('z') +1)]
word = 'hello'
new_word = [ ]
for char in word:
if char in alphabet:
new_pos = alphabet.index(char) + 1
if new_pos > len(alphabet):
new_pos %= len(alphabet)
new_word.append(alphabet[new_pos])
else:
continue
my question is: why doesn't this shift the characters of the word one place in the alphabet?