-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit.py
More file actions
36 lines (29 loc) · 905 Bytes
/
Copy pathgit.py
File metadata and controls
36 lines (29 loc) · 905 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
34
35
36
def encode(password):
password_encode = ''
for char in password:
digit = (int(char) + 3) % 10
str_digit = str(digit)
password_encode += str_digit
return password_encode
def decode(password):
password_decode = ''
for char in password:
password_decode += str((int(char) - 3) % 10)
return password_decode
def main():
while True:
print("Menu")
print("-" * 13)
print("1. Encode")
print("2. Decode")
print("3. Quit")
option = input("Please enter an option: ")
if option == "3":
break
password = input("Please enter a password to encode: ")
if option == "1":
password = input("Please enter your password to encode: ")
encode(password)
print("Your password has been encoded and stored!")
if __name__ == '__main__':
main()