def data_network(): """Verify logins for members-only network. """ # This version has 10 users. You can change the number by changing the # three tables and changing the value in the range statement of the # for loop. print("\n\tExclusive Computer Network") print("\t\tMembers only!\n") users = ["George Washington", "John Adams", "Thomas Jefferson", "James Madison", "James Monroe", "John Quincy Adams", "Andrew Jackson", "Martin Van Buren", "William Henry Harrison", "John Tyler"] nicknames = ["George", "John", "Tom", "Jemmy", "James", "Quincy", "Old Hickory", "OK", "Doc", "Tippecanoe"] passwords = ["cherry tree", "Hamilton", "Sally", "Dolly", "Doctrine", "one term", "New Orleans", "Dutch", "pneumonia", "Texas"] levels = [5,4,5,5,4,4,3,2,2,2] security = 0 found_user = False username = "" while not username: username = input("Username: ") password = "" while not password: password = input("Password: ") for i in range(10): if username == users[i]: # Found user. Now check password. found_user = True # So we know whether we even found the user in the db. if password == passwords[i]: security = levels[i] print("Welcome, ", nicknames[i]) else: print("Sorry, you don't know the password.") # Security stays 0. break # Exit the loop now. # If the user was in the db, we found him/her. if found_user: # This is where we'd print a message that would depend on # security level. pass # This does nothing. It's here as a placeholder because a statement # is required. Get rid of it when something real goes here. else: print("Apparently you don't exist.")