-
Notifications
You must be signed in to change notification settings - Fork 1
/
decode.py
41 lines (34 loc) · 1.14 KB
/
decode.py
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
30
31
32
33
34
35
36
37
38
39
40
41
import choose
def decode():
"""This allows you to decode a secret message that you have previously encrypted (only encryption made with this program are supported).
1. Enter the strange encrypted message given by program.
2. It will give you the actual readable message that was entered previously."""
string = input('\nEnter The Message You Want to Dencrypt (Decode): ')
# Splitting String into list elements by spaces.
ele = string.split(" ")
size = len(ele)
for i in range(size):
temp = ele[i]
# decode main code
temp = temp[3:]
temp = temp[:-3]
# for Single letter in a word
if(len(temp)==1):
ele[i] = temp
#for two letters in a word
elif(len(temp)<3):
temp += temp[:-1]
temp = temp[1:]
ele[i] = temp
# print(temp)
#for more than two letters in a word
else:
start = temp[-3:]
start += temp[:-3]
ele[i] = start
for i in range(size):
# print(ele[i]) # testing
print(ele[i], end=" ")
# print()
print()
choose.choose()