Created
September 27, 2013 14:53
-
-
Save Natim/6729868 to your computer and use it in GitHub Desktop.
Carré de Polybe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
M = [["A", "B", "C", "D", "E"], | |
["F", "G", "H", "IJ", "K"], | |
["L", "M", "N", "O", "P"], | |
["Q", "R", "S", "T", "U"], | |
["V", "W", "X", "Y", "Z"]] | |
def decode(texte): | |
for lettre in texte.split(): | |
if len(lettre) != 2 or not lettre.isdigit() or \ | |
int(lettre) > 55 or int(lettre) < 11: | |
raise ValueError(lettre) | |
x, y = [u - 1 for u in map(int, lettre)] | |
print M[x][y] | |
texte = raw_input("Tapez le texte à décoder: ") | |
decode(texte) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment