#-*-coding:utf8-*- from copy import deepcopy from random import shuffle alphabet = [chr(k) for k in range(ord('A'),ord('Z')+1)] key = deepcopy(alphabet) shuffle(key) print "La clé est : ", ''.join(key) message = raw_input("Quel texte chiffrer ? ") crypto = ''.join([key[alphabet.index(k)] for k in message]) print "Cryptogramme :", crypto print "Déchiffrement :", ''.join([alphabet[key.index(k)] for k in crypto])