-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathencoding.py
More file actions
33 lines (31 loc) · 837 Bytes
/
encoding.py
File metadata and controls
33 lines (31 loc) · 837 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
30
31
32
33
def encoder(num):
string = str(num)
str_blank = ''
for i in string:
i = str((int(i)+3)%10)
str_blank+=i
return str_blank
def decoder(input):
for element in input:
element = str((int(element)-3)%10)
return input
#comment
def main():
password = None
while True:
print("""Menu
-------------
1. Encode
2. Decode
3. Quit
""")
choice = input('Please enter an option: ')
if choice == '1':
password = encoder(input('Please enter your password to encode: '))
print("Your password has been encoded and stored!")
if choice == '2':
print(f'The encoded password is {password}, and the original password is {decoder(password)}.')
if choice == '3':
break
if __name__ == "__main__":
main()