Login system

I’m trying to make a login system, but an if statement that needs to be entered to log in won’t work, I have the login details in a separate file in a 2d array, and if I remove the 2d array and just keep the username, it will work but it doesn’t if I have the 2d array, here is part of my code:

f = open(‘authenticated.txt’)
authenticated = f.readline()
print(authenticated)
name = input('Enter your name to check if you’re verified: ')
while not logged_in:
for i in range(len(authenticated)):
if name == authenticated[i-1][0]:
password = input('Authenticated user, enter password to log in: ')

Here is the text file:

[[BenWherry, password], [ThomasWherry, 1qaz2wsx],[JessicaWherry, qwertyuiop]]

if I remove the 2d array and just keep the username, it will work

If the file is changed as your said:

BenWherry, ThomasWherry,JessicaWherry
or
[BenWherry, ThomasWherry, JessicaWherry]

I’m not sure how this will work. Essentially, readline() returns a string.
authenticated = f.readline()
Meaning, authenticated is a string data type but you’re accessing like a List of lists (2d array):

for i in range(len(authenticated)):
    if name == authenticated[i-1][0]:

If you add print(type(authenticated)), you will see the result is <class 'str'>.