I'm trying to create a simple Caesar Cipher function in Python that shifts letters based on input from the user and creates a final, new string at the end. Problem is that the final cipher text shows only the last shifted character, not an entire string with all the shifted characters and when the letter z for example the program doesn't restart at the beginning of the alphabet PS i am french educated so some lines might be in french Here's my code:
list=list()
r=0
choix=int(input("Veuillez entrer 1 pour coder ou 2 pour decoder"))
if choix==1 :
cle=int(input("Quelle est votre clé?"))
phrase=input("Quelle est votre phrase? ")
for i in phrase :
r=ord(i)
r=(r+cle)%26
lettre=chr(r)
list.append(lettre)
print(list)
elif choix==2 :
cle=int(input("Quelle est votre clé?"))
phrase=input("Quelle est votre phrase? ")
for i in phrase :
r=ord(i)
r=(r-cle)%26
lettre=chr(r)
list.append(lettre)
print(list)