-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLab6.py
30 lines (27 loc) · 835 Bytes
/
Lab6.py
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
def encode(password):
newPass = ""
for digit in password:
newPass += str((int(digit) + 3))
return newPass
def decode(password):
newPass = ""
for digit in password:
newPass += str((int(digit) - 3))
return newPass
def main():
menu = True
while menu:
print("1. Encode")
print("2. Decode")
print("3. Quit")
num = int(input())
if num == 1:
password = input("Enter an 8 digit password of only integers.")
print("You password has been encoded and stored!")
elif num == 2:
depassword = decode(password)
print("The encoded password is ", password, ", and the orignal password is ", depassword,"." )
else:
break
if __name__ =="__main__":
main()