0
I am trying to create a mini login system using python, where a login and password are requested, and if the two match, for example: the login is at position 2 and the password is also at position 2, the login is approved. My problem is in checking if the login and password are in the same position, how can I do that? In my current code, any password gives access to any login. I have tried to put x == y
and it didn’t work, and I also researched about, but I only found content on Numpy, can you use this library to solve my problem? (I’m starting to program now, sorry for the bad practices, if you have any other tips, I accept)
username = ['pedro', 'marcos', 'ana', 'michael', 'tomas']
key = ['pedro12', 'markos', 'anaconda', 'jackson', 'toma']
user = str(input("Digite seu username: "))
if user in username:
for x in username:
if user == x:
senha = str(input("Digite sua senha: "))
for y in key:
if senha in key:
if senha == y:
print("Olá {}".format(x))
else:
print('Acesso negado')
else:
print("Username não encontrado")
+1 for displaying with dictionary and still display method
list.index
. I would only advise adding link to the documentation (that one or that one would already help).– fernandosavio