79563341

Date: 2025-04-09 02:26:05
Score: 0.5
Natty:
Report link
you are pretty close. The code you are trying to use is not working because you compare an array, or every line, in the txt file with the user input for loginuser and loginpass. The way you structured your if statement also will not work properly as it will only check for loginpass, not loginuser. 

the way i would recommend correcting your code is like this below

  # creates and array of strings from the lines in the txt file
  database = file.readlines()
    
    # checks each string in the array
    for line in database: 

        # check if both user inputs are on a single line 
        if loginuser  in line and loginpass  in line:   
        

            print("Login successful")

            # this ends the larger whileloop, allowing the user to use other methods
        y += 1                                  
              
            # end advanced for loop goes through each line                              
            break                
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: mason T