File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 1
- LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
1
+ import string
2
2
3
3
4
4
def decrypt (message : str ) -> None :
@@ -31,15 +31,15 @@ def decrypt(message: str) -> None:
31
31
Decryption using Key #24: VOFGVWZ ROFXW
32
32
Decryption using Key #25: UNEFUVY QNEWV
33
33
"""
34
- for key in range (len (LETTERS )):
34
+ for key in range (len (string . ascii_uppercase )):
35
35
translated = ""
36
36
for symbol in message :
37
- if symbol in LETTERS :
38
- num = LETTERS .find (symbol )
37
+ if symbol in string . ascii_uppercase :
38
+ num = string . ascii_uppercase .find (symbol )
39
39
num = num - key
40
40
if num < 0 :
41
- num = num + len (LETTERS )
42
- translated = translated + LETTERS [num ]
41
+ num = num + len (string . ascii_uppercase )
42
+ translated = translated + string . ascii_uppercase [num ]
43
43
else :
44
44
translated = translated + symbol
45
45
print (f"Decryption using Key #{ key } : { translated } " )
You can’t perform that action at this time.
0 commit comments