-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChallenge 9_decoder.py
More file actions
29 lines (22 loc) · 855 Bytes
/
Challenge 9_decoder.py
File metadata and controls
29 lines (22 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Caesar cipher with a keyword
# the keyword is PYTHON
# Below is the decoder
cipher_dict = [
"P", "Y", "T", "H", "O", "N", "A", "B", "C", "D", "E", "F", "G", "I", "J", "K", "L", "M", "Q", "R", "S",
"U", "V", "W", "X", "Z"
]
normal_dict = [
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U",
"V", "W", "X", "Y", "Z"
]
Cipher = "TCKBOMQ OUJFUO, DSQR FCEO BJV RBCQ JIO CQ YORROM TJHOH RBPI RBO FPQR TPOQPM TCKBX XJSHOTJHOH. \
YSR QRCFF, KXRBJI BOFKQ. BOMO'Q RBO VJMH XJS'MO FJJECIA NJM: PMTBCGOHOQ."
Decoded_message = []
for i in Cipher:
if i in cipher_dict:
Deciphered_char = normal_dict[cipher_dict.index(i)]
Decoded_message.append(Deciphered_char)
else:
Decoded_message.append(i)
Decoded_message = ''.join(Decoded_message)
print(Decoded_message)