#-*-coding:utf8-*- def cesar(texte, cle): return ''.join([chr((ord(k)-ord('a')+cle)%26+ord('a')) for k in texte]) def cesar2(texte, cle): crypto = "" for k in texte.lower(): # If it is a letter if k.isalpha(): crypto += chr((ord(k)-ord('a')+cle)%26+ord('a')) else: crypto += k return crypto texte = raw_input("Quel texte chiffrer ? ") cle = input("Quelle clé de chiffrement ? ") cryptogram = cesar2(texte, cle) print "Texte chiffré :", cryptogram print "Texte dechiffré :",cesar2(cryptogram, -cle)