title: why my else cannoot execute while the statement is else?
body: <p>I want to create a login page script with the username and password as the data account from db. n then when my input is doesn't match the else didn't execute while username and password is did not exist in db. so what should i do to fix this. any somebody help me please</p>
  <pre><code>def logindb():
  print (&quot;==&quot;*15+&quot;\nPlease insert your username and password.&quot;)
  username = input (&quot;Username : &quot;)
  password = input (&quot;Password : &quot;)
  cursor.execute(f&quot;SELECT * FROM data WHERE username='{username}' and password='{password}'&quot;)
  result = cursor.fetchall()
  for i in result:
      if (i[0]) == username and (i[1]) == password:
          print (&quot;==&quot;*15+&quot;\n\tLogin Success.\n&quot;+&quot;==&quot;*15)
      else:
          print (&quot;==&quot;*15+&quot;\nUsername or password is wrong.\n&quot;+&quot;==&quot;*15)
  </code></pre>