title: Validation of a Password - Python
body: <p>So I have to create code that validate whether a password:</p>
  
  <ul>
  <li>Is at least 8 characters long   </li>
  <li>Contains at least 1 number   </li>
  <li>Contains at least 1 capital letter</li>
  </ul>
  
  <p>Here is the code:</p>
  
  <pre><code>def validate():
      while True:
          password = input("Enter a password: ")
          if len(password) &lt; 8:
              print("Make sure your password is at lest 8 letters")
          elif not password.isdigit():
              print("Make sure your password has a number in it")
          elif not password.isupper(): 
              print("Make sure your password has a capital letter in it")
          else:
              print("Your password seems fine")
              break
  
  validate()
  </code></pre>
  
  <p>I'm not sure what is wrong, but when I enter a password that has a number - it keeps telling me that I need a password with a number in it. Any solutions?</p>