[Solved] calling functions for a password checker


for i in range(0,5):
    password = str(input("Enter password: "))
    password_checker_result = password_checker(password)
    if not password_checker_result:
        print("Invalid password")
    else:
        print("Valid password")
        break

This code will work for you, now let me explain:

The flow is as following:

This is done 5 times (is inside the for loop):

1) Request password from user.

2) Check if password is valid.

3) Print according to valid/not valid result.

  • The fact that you are using a for loop does not require you to actually use the iteration index (meaning ‘i’ in our case)

2

solved calling functions for a password checker