-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodec.py
More file actions
executable file
·42 lines (31 loc) · 968 Bytes
/
codec.py
File metadata and controls
executable file
·42 lines (31 loc) · 968 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
37
38
39
40
41
42
# Rob's codec file
password = ""
encoded_password = ""
def encode():
global password
global encoded_password
password = input("Please enter your password to encode: ")
encoded_password = ""
for digit in password:
encoded_password += str((int(digit) + 3) % 10)
print("Your password has been encoded and stored!")
return encoded_password
def decode(encoded_password):
print(f"The encoded password is {encoded_password}, and the original password is {password}.")
def main():
while True:
print("Menu")
print("-------------")
print("1. Encode")
print("2. Decode")
print("3. Quit", end="\n\n")
option = int(input("Please enter an option: "))
match option:
case 1:
encoded_password = encode()
case 2:
decode(encoded_password)
case 3:
exit()
if __name__ == "__main__":
main()