Apr-15-2019, 11:52 PM
Thanks Yoriz. I am unable to get the credential check to turn up positive results. It loops through and then ends with "Login failed" even when I enter root, toor which is in adminList.
# Administrator accounts list adminList = [ { "username": "DaBigBoss", "password": "DaBest" }, { "username": "root", "password": "toor" } ] # Build your login functions below # creates a function called getCreds with no paramaters def getCreds(): #Prompts user for their username and password username = input("What is your username? ") password = input("What is your password? ") #Dictionary that retains username and password userInfo = [ { "username" : str(username), "password" : str(password) } ] #Return userInfo return userInfo user_info = getCreds() def checkLogin(user_info, adminList): if user_info in adminList: loggedIn = True else: loggedIn = False while loggedIn == False: print("Login Failed. ") retry = getCreds() return retry getCreds() checkLogin(user_info, adminList)No errors but not doing the loop correctly. Here is the output:
Output:What is your username? root
What is your password? toor
What is your username? root
What is your password? toor
Login Failed.
What is your username? root
What is your password? toor