hi i'm complete confused on how to do what i want, i'm basically checking a file that it has two words in for this instance the username and password for a user.
text = open("Accounts.dat", 'w')
text.writelines("the username")
text.writelines("\n")
text.writelines("the password")
text.close()
username = input("Enter username: ")
password = input("Enter password: ")
data = open("Accounts.dat").read()
if username and password in data:
print("works")
else:
print("doesn't work")
data.close()
this code does work in some ways, like if i just enter the correct username and nothing for the password it prints("works") but if i enter nothing into username and password it prints("doesn't work"), then if i just type the correct password and nothing for the username it doesn't work.
i need it so it only prints ("works") when both the username and password are correct.