so I have the encrypt dictionary already set up:
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ "
encrypt = "CDEFGHIJKLMNOPQRSTUVWXYZAB "
word = input("Enter the message: ")
d = {alphabet[i]: encrypt[i] for i in range(len(alphabet))}
and lets say I want to encrypt word, I would use replace()here, but if I use that one, it just replaces everything with A and B.
My code currently looks like that:
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ "
encrypt = "CDEFGHIJKLMNOPQRSTUVWXYZAB "
d = {alphabet[i]: encrypt[i] for i in range(len(alphabet))}
word = input("Enter a word: ")
for key in d.keys():
word = word.upper().replace(key, d[key])
print(word)
and in the Terminal it prints out "BAAB". Not sure why its only using the A and B and nothing more.