Jul 03, 2024

Wiki

Python

Aide

edit SideBar

Search

Polybe

  #-*-coding:utf8-*-
  # Encryption dictionary
  dico = {chr(ord('a')+k): str(k/5+1)+str(k%5+1) for k in range(25)}
  dico['w']='5252'
  dico['x']='53'
  dico['y']='54'
  dico['z']='55'
  # Decryption dictionary
  ocid = {dico[k]:k for k in dico.keys()}
  texte = raw_input("Quel texte à chiffrer ? ")
  cryptogram = ''.join([dico[k] for k in texte])
  print "Le cryptogramme",cryptogram
  decypher = [cryptogram[k:k+2] for k in range(0,len(cryptogram)-1,2)]
  print decypher

Page Actions

Recent Changes

Group & Page

Back Links