-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
42 lines (38 loc) · 1.02 KB
/
main.py
File metadata and controls
42 lines (38 loc) · 1.02 KB
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
#Ryan Mijares
def Decode(input):
new_pass = ''
for number in input:
if int(number) <= 2:
new_pass += str((int(number) + 7))
else:
new_pass += str((int(number) - 3))
return [new_pass, input]
def encoder(password):
new_pass = ''
for number in password:
if int(number)+3 >= 7:
new_pass += str((int(number) - 7))
else:
new_pass += str((int(number) + 3))
return new_pass
def menu():
print("Menu")
print("-------------")
print("1. Encode")
print("2. Decode")
print("3. Quit")
def main():
while True:
menu()
option = int(input("Please enter an option: "))
if option == 1:
u_input = input("Please enter your password to encode: ")
encoder(u_input)
print("Your password has been encoded and stored!")
elif option == 2:
value = Decode(u_input)
print(f"The encoded password is {value[0]}, and the original password is {value[1]}")
elif option == 3:
break
if __name__ == "__main__":
main()