-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpassword_program.py
More file actions
34 lines (29 loc) · 916 Bytes
/
password_program.py
File metadata and controls
34 lines (29 loc) · 916 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
def menu():
print("Menu")
print("-------------")
print("1. Encode")
print("2. Decode")
print("3. Quit")
def encode():
to_encode = (input("Please enter your password to encode: "))
encoded = [int(number) + 3 for number in to_encode]
return encoded
def decoder(encoded_string):
encoded_list = list(encoded_string)
for i in range(0, len(encoded_list)):
encoded_list[i] = int(encoded_list[i])
encoded_list[i] -= 3
if encoded_list[i]<0:
encoded_list[i] += 10
encoded_list[i] = str(encoded_list[i])
return ''.join(encoded_list)
def main():
while True:
user_input = input("Please enter an option: ")
if user_input == "0":
break
elif user_input == "1":
new_password = encode()
print("Your password has been encoded and stored!")
if __name__ == "__main__":
main()