Trying to create a function to validate password without using re or main(), and will return true or false

def isValidPassword(pw):  
    SpecialSymbol = ["@", "#", "$", " ", "&", "%"]
    val = True   
    
    if len(pw) < 10:
        print("enter at least 10 characters")
        val = False
        
    if not any(char.isdigit(3) for char in pw):
        print("enter at least 3 digit numbers")
        val = False
        
    if not any(char.isupper() for char in pw):
        print("enter at least 1 uppercase letter")
        val = False
        
    if not any(char.islower() for char in pw):
        print("enter at least 1 lowercase letter")
        val = False
        
    if not any(char in SpecialSymbol for char in pw):
        print("enter at least 1 special character")
        val = False
    if val:    
        return val
        
    if (isValidPassword(pw)):
        print(True)    
    else:
        print(False)       
print(isValidPassword("1234rewq"))

it’s returning [TypeError: str.isdigit() takes no arguments (1 given)], and im not sure why sorry just started learning, was referencing some of the materials i could find but, dont really know what im doing

Answer

use sum on function isdigit() instead of any().

try this:

def isValidPassword(pw):  
    SpecialSymbol = ["@", "#", "$", " ", "&", "%"]
    val = True   
    
    if len(pw) < 10:
        print("enter at least 10 characters")
        val = False
        
    if sum(char.isdigit() for char in pw) < 3:
        print("enter at least 3 digit numbers")
        val = False
        
    if not any(char.isupper() for char in pw):
        print("enter at least 1 uppercase letter")
        val = False
        
    if not any(char.islower() for char in pw):
        print("enter at least 1 lowercase letter")
        val = False
        
    if not any(char in SpecialSymbol for char in pw):
        print("enter at least 1 special character")
        val = False
    if val:    
        return val
        
if (isValidPassword("1234rewq")):
    print(True)    
else:
    print(False)