Password check- Python 3
<p>Write a function that checks whether a string is valid password.</p>

<p>Rules:
 Must have at least 8 characters
 A password must consist of only letters and digits
 A password must contain at least 2 digits</p>

<p>Heres what I have so far, what am i doing wrong? thank you</p>

<pre><code>def getPassword():
   password = input("Enter password: ")
   return password

def validPassword(password):
   if len(password) &gt;= 8:
      valid = True
   if password.alnum():
      valid = True
   if password.isdigit &lt; 2:
      valid = True
   else:
      return False


def main():
   password = validPassword()
   if validPassword(password):
      print(password, "is valid")
   else:
      print(password, "is invalid")
main()
</code></pre>