title: i cant understand whats wrong with my code i get logged if i enter any of the users passwords
body: <p>this my login function</p>
  <pre><code>import getpass
  import warnings
  import csv
  import time
  
  admin={&quot;Evan&quot;:&quot;1234&quot;,&quot;Nirmal&quot;:&quot;4567&quot;,&quot;admin&quot;:&quot;1729&quot;}
  manager={&quot;Max&quot;:&quot;7785&quot;,&quot;Jack&quot;:&quot;5648&quot;,'Alan':'5464'}
  standard={&quot;Smith&quot;:&quot;2548&quot;,&quot;Virat&quot;:&quot;1818&quot;,'Steve':'5487'}
  
  scheduled={'MH370':[&quot;10:10&quot;,'Delhi',&quot;Delayed&quot;],'KI784':['1:20','Pune','Delayed'],
             'PH169':['12:20','Seattle','Scheduled'],'BH234':['15:20','Bangalore','Scheduled'],
             'PH234':['15:00','Prayagraj','Delayed'],'BT452':['18:30','Malaysia','Scheduled'],
             'KR234':['15:20','Cuba','Scheduled']}
  
  cancelled={'AI169':[&quot;11:30&quot;,&quot;Bombay&quot;,&quot;Cancelled&quot;]}
  
  def login(u):
    q=2
  
    while q==2:
      warnings.filterwarnings(&quot;ignore&quot;)
  
      try :
          uid=u
          
          upwd=getpass.getpass(prompt=&quot;Enter the User Password : -\t&quot;)
  
          if uid in admin or uid in manager or uid in standard:
              found=1
  
          else:
              found=0
  
          if upwd in admin.get(uid) or upwd in manager.get(uid) or upwd in standard.get(uid):
              found=1
  
          else:
              found=0
              
      except:
          print(&quot;&quot;)
  
      if found==0:
          time.sleep(1)
          print(&quot;\n... Entered User Name  / Password is wrong ...&quot;)
          
      else:
          time.sleep(1)
          print(&quot;\n System Starting.... \a\a\a\a\a\a&quot;)
          break
  
  </code></pre>
  <p>if I type Evan as the username and type any of the passwords in the admin dictionary(1234,4567,1729) I get logged in. Here's the full code</p>
  <pre><code>import getpass
  import warnings
  import csv
  import time
  
  admin={&quot;Evan&quot;:&quot;1234&quot;,&quot;Nirmal&quot;:&quot;4567&quot;,&quot;admin&quot;:&quot;1729&quot;}
  manager={&quot;Max&quot;:&quot;7785&quot;,&quot;Jack&quot;:&quot;5648&quot;,'Alan':'5464'}
  standard={&quot;Smith&quot;:&quot;2548&quot;,&quot;Virat&quot;:&quot;1818&quot;,'Steve':'5487'}
  
  scheduled={'MH370':[&quot;10:10&quot;,'Delhi',&quot;Delayed&quot;],'KI784':['1:20','Pune','Delayed'],
             'PH169':['12:20','Seattle','Scheduled'],'BH234':['15:20','Bangalore','Scheduled'],
             'PH234':['15:00','Prayagraj','Delayed'],'BT452':['18:30','Malaysia','Scheduled'],
             'KR234':['15:20','Cuba','Scheduled']}
  
  cancelled={'AI169':[&quot;11:30&quot;,&quot;Bombay&quot;,&quot;Cancelled&quot;]}
  
  #This function is responsible for shlowing all the users
  
  def view_users():
      admin1=list(admin.keys())
      manager1=list(manager.keys())
      standard1=list(standard.keys())
      print(&quot;Admins are :- &quot;,admin1)
      print(&quot;Managers are :- &quot;,manager1)
      print(&quot;Standard Users are :- &quot;,standard1)
      
  #This function is responsible for deleting users
  
  def delete_user_account():
      user=input(&quot;Enter the username to be deleted : -\t&quot;)
      time.sleep(1)
  
      if not(user in admin or user in manager or user in standard):
          print(&quot;Username not found&quot;)
  
      else:
  
          if user==&quot;admin&quot;:
              print(&quot;Cannot delete main admin&quot;)
  
          elif user in admin.keys():
  
              if user!=&quot;admin&quot;:
                  del admin[user]
                  print(&quot;Admin user successfully deleted&quot;)
  
          elif user in manager.keys():
              del manager[user]
              print(&quot;Manager user successfully deleted&quot;)
  
          elif user in standard.keys():
              del standard[user]
              print(&quot;Standard user successfully deleted&quot;)
  
          else:
              pass
  
  #this function is responsible for adding admin
          
  def add_admin():
      user=input(&quot;Enter the username to be added : -\t&quot;)
      time.sleep(1)
  
      if user in admin or user in manager or user in standard:
          print(&quot;Username already exists&quot;)
  
      else:
          password=input(&quot;Enter the password : -\t&quot;)
          time.sleep(1)
          admin[user]=password
          print(&quot;Admin successfully added&quot;)
  
  #this function is responsible for adding manager
          
  def add_manager():
      user=input(&quot;Enter the username to be added : -\t&quot;)
      time.sleep(1)
  
      if user in admin or user in manager or user in standard:
          print(&quot;Username already exists,try again&quot;)
  
      else:
          password=input(&quot;Enter the password : -\t&quot;)
          time.sleep(1)
          manager[user]=password
          print(&quot;Manager successfully added&quot;)
  
  #this function is responsible for adding standard user
          
  def add_standard():
      user=input(&quot;Enter the username to be added : -\t&quot;)
      time.sleep(1)
      
      if user in admin or user in manager or user in standard:
          print(&quot;Username already exists,try again&quot;)
  
      else:
          password=input(&quot;Enter the password : -\t&quot;)
          time.sleep(1)
          standard[user]=password
          print(&quot;Standard user successfully added&quot;)
  
  #this function is responsible for adding flights
          
  def update_add_flights():
      choice1=input(&quot;Do you want to schedule a new flight(Y,N) : -\t&quot;)
  
      if choice1 in (&quot;Y&quot;,&quot;y&quot;):
          name=input(&quot;Enter the name of the flight : -\t&quot;)
  
          if name in scheduled:
              print(&quot;Flight already added&quot;)
              update_add_flights()
  
          else:
              time=input(&quot;Enter the departure time : -\t&quot;)
              dest=input(&quot;Enter the flight destination : -\t&quot;)
              stat=input(&quot;Enter flight status : -\t&quot;)
  
              scheduled[name]=[time,dest,stat]
              print(&quot;Flight &quot;,name,&quot;successfully added&quot;)
      else:
        choice2=input(&quot;Do you want to update existing flight information(Y,N) : -\t&quot;)
  
        if choice2 in (&quot;Y&quot;,&quot;y&quot;):
          name=input(&quot;Enter the name of the flight : -\t&quot;)
  
          if name in scheduled:
              time=input(&quot;Enter the departue time : -\t&quot;)
              dest=input(&quot;Enter the flight destination : -\t&quot;)
              stat=input(&quot;Enter flight status : -\t&quot;)
              
              del scheduled[name]
              scheduled[name]=[time,dest,stat]
              print(&quot;Flight updated&quot;)
  
          else:
              print(&quot;No flight by this name&quot;)
  
  #this function is responsible for cancelling flights
              
  def cancel_flights():
      name=input(&quot;Enter name of flight : -\t&quot;)
      time.sleep(1)
  
      if name in cancelled:
          print(&quot;Flight already cancelled&quot;)
  
      elif name in scheduled:
          n=scheduled.get(name)
          del scheduled[name]
          cancelled[name]=n
          print(&quot;Flight cancelled&quot;)
  
      else:
          print(&quot;Flight not found,please try again&quot;)
  
  #this function is responsible for viewing flights
          
  def view_flights():
      print()
      print(&quot;Scheduled Flights&quot;)
      print()
      time.sleep(1)
      print(&quot;Flight Number&quot;,'%12s'% 'ETA','%25s'% 'Destination','%25s'% &quot;Status&quot;)
      time.sleep(1)
      print()
      for i in scheduled:
          print(i, '%25s'%scheduled[i][0], '%25s'%scheduled[i][1], '%25s'%scheduled[i][2])
          time.sleep(1)
  
      print()
      print()
  
      print(&quot;Cancelled Flights&quot;)
      print()
      time.sleep(1)
      print(&quot;Flight Number&quot;,'%12s'% 'ETA','%25s'% 'Destination','%25s'% &quot;Status&quot;)
      time.sleep(1)
      print()
  
      for j in cancelled:
          print(j, '%25s'%cancelled[j][0], '%25s'%cancelled[j][1], '%25s'%cancelled[j][2])
          time.sleep(1)
  
  
  #admin control panel
          
  def admins():
    q=1
  
    while q==1:
      command=int(input('''
  To view details of flight    press 1
  To add/update a flight     press 2
  To cancel a flight             press 3
  To manage users             press 4
  
  Press any other key to exit
   : - '''))
  
      if command==1:
          view_flights()
  
      elif command==2:
          update_add_flights()
  
      elif command==3:
          cancel_flights()
  
      elif command==4:
              print()
              print()
              command2=int(input('''
  To add users             press 1
  To delete users         press 2
  To view users           press 3
  
  Press any other key to return to control panel
   : - '''))
              time.sleep(1)
              print()
              print()
  
              if command2==1:
                  command3=int(input('''
  To add admin user           press 1
  To add manager user       press 2
  To add standard user       press 3
  
  To return to contol panel press any other value
  : - '''))
                  print()
                  time.sleep(1)
                  
                  if command3==1:
                          add_admin()
  
                  elif command3==2:
                          add_manager()
  
                  elif command3==3:
                          add_standard()
  
                  else:
                          print('''Returning to control panel''')
                          time.sleep(1)
  
              elif command2==2:
                  delete_user_account()
  
              elif command2==3:
                  view_users()
                  
              else:
                  print()
  
      else:
          break
  
  #manager control panel
      
  def managers():
    q=1
  
    while q==1:
      time.sleep(1)
      command=int(input('''
  To view details of flight      press 1
  To add/update a flight       press 2
  To cancel a flight               press 3
  To manage users               press 4
  
  Press any other key to exit
  : - '''))
      time.sleep(1)
      print()
  
      if command==1:
          view_flights()
  
      elif command==2:
          update_add_flights()
  
      elif command==3:
          cancel_flights()
  
      elif command==4:
              command2=int(input('''
  To add users        press 1
  To delete users    press 2
  To view users      press 3
  
  Press any other key to return to control panel
  : - '''))
              print()
              time.sleep(1)
  
              if command2==1:
                  command3=int(input('''
  To add manager user        press 1
  To add standard user        press 2
  
  To return to contol panel press any other value
  : - '''))
                  print()
                  time.sleep(1)
  
                  if command3==1:
                          add_manager()
  
                  elif command3==2:
                          add_standard()
  
                  else:
                          print('''Returning to control panel''')
  
              elif command2==2:
                  delete_user_account()
  
              elif command2==3:
                  view_users()
                  
              else:
                  print()
  
      else:
          break
      
  #standard user control panel
      
  def standards():
    q=1
  
    while q==1:
      time.sleep(1)
      command=int(input('''
  To view details of flight       press 1
  To view users                      press 2
  
  Press any other number to exit
  : - '''))
      print()
      time.sleep(1)
  
      if command==1:
          view_flights()
  
      elif command==2:
          view_users()
          
      else:
          break
      
  #login function
  
  def login(u):
    q=2
  
    while q==2:
      warnings.filterwarnings(&quot;ignore&quot;)
  
      try :
          uid=u
          
          upwd=getpass.getpass(prompt=&quot;Enter the User Password : -\t&quot;)
  
          if uid in admin or uid in manager or uid in standard:
              found=1
  
          else:
              found=0
  
          if upwd in admin.get(uid) or upwd in manager.get(uid) or upwd in standard.get(uid):
              found=1
  
          else:
              found=0
              
      except:
          print(&quot;&quot;)
  
      if found==0:
          time.sleep(1)
          print(&quot;\n... Entered User Name  / Password is wrong ...&quot;)
          
      else:
          time.sleep(1)
          print(&quot;\n System Starting.... \a\a\a\a\a\a&quot;)
          break
  
  time.sleep(1)
  username=input(&quot;Enter Username : -\t&quot;)
  
  login(username)
  
  time.sleep(1)
  if username in admin:
      admins()
  
  elif username in manager:
      managers()
  
  elif username in standard:
      standards()
  
  else:
      pass
  
  </code></pre>
  <p>this is a flight management program i had created for my school project. I am new to python and this our first project. can anyone pls help.</p>