From e173839c44257d0187bb2ec087124db6e2ecde99 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 31 Jul 2019 15:46:56 +0300 Subject: Optimised Number names code --- Python/Beginner training/Tasks.py | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'Python/Beginner training') diff --git a/Python/Beginner training/Tasks.py b/Python/Beginner training/Tasks.py index 873bde6..d60a8bf 100644 --- a/Python/Beginner training/Tasks.py +++ b/Python/Beginner training/Tasks.py @@ -65,7 +65,28 @@ def Factoriel(): print(final_int) -Divide() -Histogram() -NumberMatrix() -Factoriel() \ No newline at end of file +def CaesarCypher(): + while True: + key = input("Type a key: ") + msg = input("Type a message: ") + + decoded = [] ; encoded = [] + for c in msg: + decoded.append(c - key) + encoded.append(c + key) + + print(end="Decoded message: ") + for c in decoded: + print(end=c) + print() + + print(end="Encoded message") + for c in encoded: + print(end=c) + + +#Divide() +#Histogram() +#NumberMatrix() +#Factoriel() +CaesarCypher() \ No newline at end of file -- cgit v1.2.3