Dec-12-2019, 03:58 AM
Ichabod - I don't have a choice. This is a program for a class I'm taking and the list was defined for me. I'm simply supposed to write the code to display the password for a given website.
I hate to be so thick about this but I'm just not getting it. I included some instructions from my prof.
I hate to be so thick about this but I'm just not getting it. I included some instructions from my prof.
passwords = [["yahoo","XqffoZeo"],["google","CoIushujSetu"]] while True: print("What would you like to do:") print(" 1. Open password file") print(" 2. Lookup a password") print(" 3. Add a password") print(" 4. Save password file") print(" 5. Print the encrypted password list (for testing)") print(" 6. Quit program") print(" 7. Delete a password") print("Please enter a number (1-7)") choice = input() if(choice == '2'): #Lookup at password print("Which website do you want to lookup the password for?") for keyvalue in passwords: print(keyvalue[0]) passwordToLookup = input() if passwordToLookup in passwords: print(passwords[passwordToLookup]) else: print ('Not in there.')# If the website isn't in the list it prints, Not in there. #2. Check if the name is found. To index a list of lists you use 2 square backet sets # So passwords[0][1] would mean for the first item in the list get it's 2nd item (remember, lists start at 0) # So this would be 'XqffoZeo' in the password list given what is predefined at the top of the page. # If you created a loop using the syntax described in step 1, then i is your 'iterator' in the list so you # will want to use i in your first set of brackets.