-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChallenge 9_encoder.py
More file actions
29 lines (22 loc) · 853 Bytes
/
Challenge 9_encoder.py
File metadata and controls
29 lines (22 loc) · 853 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 encoder
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"
]
Message = "CIPHERS EVOLVE, JUST LIKE HOW THIS ONE IS BETTER CODED THAN THE LAST CAESAR CIPHY YOU\
DECODED. BUT STILL, PYTHON HELPS. HERE'S THE WORD YOU'RE LOOKING FOR: ARCHIMEDES."
Encoded_message = []
for i in Message:
if i in normal_dict:
Ciphered_char = cipher_dict[normal_dict.index(i)]
Encoded_message.append(Ciphered_char)
else:
Encoded_message.append(i)
Encoded_message = ''.join(Encoded_message)
print(Encoded_message)