Python Forum
Something is not working and i have no idea what
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Something is not working and i have no idea what
#1
Hello guys . I'm new here and i'm new to coding so don't be cruel please. Here is my issue : i'm learning lists now and creating simple program which works like log in screen so i've created 2 lists : in the first one we have emails of registered profiles ,in the second one we have passwords . Everything sorted by index , so for the first email in the list ONLY the first password in the other list should be correct .

emails = ['email one', 'email two', 'email three', 'email four']
passwords = [1111, 2222, 3333, 4444]

email = input('Your email ')
while email not in emails:
    print('EMAIL NOT FOUND')
    email = input('Your email ')

password = int(input('Your password '))
while password not in passwords:
    print('PASSWORD NOT FOUND')
    password = int(input('Your password '))

EMAIL_INDEX = emails.index(email)
PASSWORD_INDEX = passwords.index(password)
while PASSWORD_INDEX != EMAIL_INDEX:
    print('YOUR PASSWORD INCORRECT')
    password = int(input('Your password '))
So the logic of this code is simple , firstly user has to write his email if the email in the list than user can write his password , while it's not in the list user has to write it over and over again this part works perfectly but with passwords i have troubles . Let's continue, user writes password ,while it's not in the list user has to write it again , but next part is kinda tricky . If user writes password FOR THE FIRST TIME which has the same index as email he had written before , than everything is working fine and password recognized... , but if you try to write some random password first and only after that you write correct one you still get 'YOUR PASSWORD INCORRECT' message over and over again ....
I'm sure i've messed up somewhere but i don't get any errors to google where exactly so i'm writing here ... please help
Thanks
Reply


Messages In This Thread
Something is not working and i have no idea what - by RavenSenin - Aug-03-2021, 07:03 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020