I'm trying to make this code print(True) if the username and password given matches the admin list.
# Admin list format = ["name1", "password1", "name2", "password2"...]
admin = ["CalvinSup", "LynnGoated", "DavidLynn", "CalvinBestStudent"]
isAdmin = False
username = "CalvinSup"
password = "LynnGoated"
for i in range(0, len(admin), 2):
print(i)
print(i+1)
print(admin[i])
print(admin[i+1])
if (username == admin[i]) and (password == admin[i+1]):
isAdmin == True
if isAdmin:
print(True)
elif not isAdmin:
print(False)
But it didn't work cuz here's the output, I even added print(i), print(i+1), etc... to check the values
Here's the full output:
0
1
CalvinSup
LynnGoated
2
3
DavidLynn
CalvinBestStudent
False
As you can see it didn't work cuz it returned False, is there some logical error?