summaryrefslogtreecommitdiff
path: root/rot13.py
diff options
context:
space:
mode:
authorjerome <jerome@xlinfo.fr>2025-06-16 23:54:14 +0200
committerjerome <jerome@xlinfo.fr>2025-06-16 23:54:14 +0200
commit1dede75643c4a6811b9fdd78557cf7c636b3e332 (patch)
treebd5801003912a692a46e2100126a4d69b8fac827 /rot13.py
parentf963769e20abe1bd2e2814c50d4ea986a63e49f9 (diff)
downloadpython-1dede75643c4a6811b9fdd78557cf7c636b3e332.tar.gz
python-1dede75643c4a6811b9fdd78557cf7c636b3e332.zip
rot13
Diffstat (limited to 'rot13.py')
-rw-r--r--rot13.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/rot13.py b/rot13.py
new file mode 100644
index 0000000..b2730f1
--- /dev/null
+++ b/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)