lundi 24 octobre 2016

why can't i run an if statement if input is exactly a certain string not only in it (python)

My problem is i only want my if statement to run if the input is exactly the password not more or less but exactly the password. what it does is still works if it has extra characters on the end or beginning. for example say my password is

("hi")

and i type

("this")

it will still say the password is correct, my code looks like this how can i fix it.

if esa in ("hi"):
   print ("correct password")

Aucun commentaire:

Enregistrer un commentaire