From 507ad1caffb2ef4d4d345a432f9d449205adad2f Mon Sep 17 00:00:00 2001 From: Stanislav Mykhailenko Date: Wed, 21 Dec 2022 21:34:47 +0200 Subject: [PATCH] Update Lesson 2 Task %*f#ncA0#>? to use maketrans --- Lesson_2/We know/dumb_decryptor.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Lesson_2/We know/dumb_decryptor.py b/Lesson_2/We know/dumb_decryptor.py index 9ca2e56..52ffcb5 100644 --- a/Lesson_2/We know/dumb_decryptor.py +++ b/Lesson_2/We know/dumb_decryptor.py @@ -5,6 +5,7 @@ # Return codes: # 0 - OK -import codecs +rot13 = str.maketrans('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', + 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm') -print(codecs.encode(input("Enter message: "), "rot13")) +print(input("Enter message: ").translate(rot13))