How can i get my program to return the password strength
<p>I'm struggling with my password rater program. How can i make sure that when i insert a password, my program returns the password strength. When i run this program it says that password_strength is stored at .....) is the return that i call at the end of my program wrong?</p>

<pre><code>print ("Welcome to this password rater program")
print ("Your password needs to have a minimum of 6 characters with a maximum of 20 characters.")
print ("Your password can contain lowercase and uppercase characters, numbers and special characters")
print("")


password = input("Please insert your password: ")


def check_len(password):
    l = len(password)
    if 6 &lt; l &lt; 20:
        x = check_char(password, l)
    else:
        x =  0
    return x


def check_char(password, l):
    for i in range(l):
        ascii = ord(password[i])
        num = 0                                
        upper = 0                               
        symbols = 0
        lower = 0
        space = 0

        if  96 &lt; ascii &lt; 123:      
            lower = 15
        elif 47 &lt; ascii &lt; 58:     
            num = 25
        elif 64 &lt; ascii &lt; 91:     
            upper = 25
        elif ascii == 32:
            space = 30
        else:                               
            symbols = 25
        total = ((lower + num + upper + space + symbols) * len(password))
    return total


def password_strength(total):
    if total &gt;= 1000:
        print("Your chosen password is Very strong")
    elif 700 &lt; total &lt; 999:
        print("Your chosen password is strong")
    elif 500 &lt; total &lt; 699:
        print("your chosen password is medium")
    elif total &lt;= 500:
        print("Your chosen password is weak")
    return total


strength = check_len(password)
print(password_strength(strength))
</code></pre>

<p>Well first of all, you tell python to print the function, not the evaluation of the function. This is why you get that message.</p>

<p>Also, you never call any of the functions you wrote. To get a working program
after the declaration of all definitions is the following:</p>

<p>Call the check_len definition:</p>

<pre><code>strength = check_len(password)
</code></pre>

<p>This definition doesn't return any value though. You could change it to:</p>

<pre><code>def check_len(password):
    l = len(password)
    if 6 &lt; l &lt; 16:
        x = check_char(password, l)
    else:
        x =  0
    return x
</code></pre>

<p>To have it return the score/strength.</p>

<p>Finally you should process the score using your 'password_strength' definition:</p>

<pre><code>password_strength(strength)
</code></pre>

<p>In this line there is no need to print, because the printing statements are in the definition itself. If you want to print the final score as well though, you could make it into the following line:</p>

<pre><code> print(password_strength(strength))
</code></pre>

<p>One more debug thingy: your check_char definition doesn't take any arguments.
You could solve this by changing it into:</p>

<pre><code>def check_char(password, l):
</code></pre>

<p>Final code:
    print ("Welcome to this password rater program")
    print ("Your password needs to have a minimum of 6 characters with a maximum of 16 characters.")
    print ("Your password can contain lowercase and uppercase characters, numbers and special characters")
    print ("")</p>

<pre><code>password = raw_input("Please insert your password: ")


def check_len(password):
    l = len(password)
    if 6 &lt; l &lt; 16:
        x = check_char(password, l)
    else:
        x =  0
    return x


def check_char(password, l):
    for i in range(l):
        ascii = ord(password[i])
        num = 0                                
        upper = 0                               
        symbols = 0
        lower = 0
        space = 0

        if  96 &lt; ascii &lt; 123:      
            lower = 15
        elif 47 &lt; ascii &lt; 58:     
            num = 25
        elif 64 &lt; ascii &lt; 91:     
            upper = 25
        elif ascii == 32:
            space = 30
        else:                               
            symbols = 25
        total = ((lower + num + upper + space + symbols) * len(password))
    return total


def password_strength(total):
    if total &gt;= 1000:
        print("Your chosen password is Very strong")
    elif 700 &lt; total &lt; 999:
        print("Your chosen password is strong")
    elif 500 &lt; total &lt; 699:
        print("your chosen password is medium")
    elif total &lt;= 500:
        print("Your chosen password is weak")
    return total


strength = check_len(password)
print(password_strength(strength))     `
</code></pre>

python python-3.x