diff options
| author | jerome <jerome@xlinfo.fr> | 2025-10-12 17:41:43 +0200 |
|---|---|---|
| committer | jerome <jerome@xlinfo.fr> | 2025-10-12 17:41:43 +0200 |
| commit | ec8893a097a6c0fffebd7db9e4a5568a3bf4df47 (patch) | |
| tree | ffebe60c3aa98df05d14aec8cea937430272c1ec /crypto/rot13.py | |
| parent | ba41fa46e69dbb264dfbed1b9fca5daab44a07c7 (diff) | |
| download | python-ec8893a097a6c0fffebd7db9e4a5568a3bf4df47.tar.gz python-ec8893a097a6c0fffebd7db9e4a5568a3bf4df47.zip | |
organisation
Diffstat (limited to 'crypto/rot13.py')
| -rw-r--r-- | crypto/rot13.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/crypto/rot13.py b/crypto/rot13.py new file mode 100644 index 0000000..b2730f1 --- /dev/null +++ b/crypto/rot13.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +import string + +def rot13(char): + liste = list(string.ascii_lowercase)*2 + list(string.ascii_uppercase)*2 + if char not in liste: + return char + else: + return liste[liste.index(char)+13] + +msg = input("Votre message : ") +msgChiffre = str() +for lettre in msg: + msgChiffre = msgChiffre + rot13(lettre) +print(msgChiffre) |
