• Acceptable Password II - faulty assert

 

I got an error at the second assert message, where it checks if 'muchlonger' is a valid password. The goal is

to have more than 6 symbols in password, one of which should be a number.

This assert is false, and should be altered

Taken from mission Acceptable Password I

def isacceptablepassword(password: str) -> bool: count = 0 length = 0 for i in range(len(password)): length = length + 1 if password[i].isdigit(): count = count + 1 if length > 6 and count > 0: return True return False

if name == 'main': print("Example:") print(isacceptablepassword('short'))

# These "asserts" are used for self-checking and not for an auto-testing
assert is_acceptable_password('short') == False
assert is_acceptable_password('muchlonger') == True
assert is_acceptable_password('ashort') == False
print("Coding complete? Click 'Check' to earn cool rewards!")

if name == "main": # These "asserts" are used for self-checking and not for an auto-testing assert isacceptablepassword("short") == False assert isacceptablepassword("muchlonger") == False assert isacceptablepassword("ashort") == False assert isacceptablepassword("muchlonger5") == True assert isacceptablepassword("sh5") == False print("Coding complete? Click 'Check' to earn cool rewards!")

From: https://py.checkio.org/mission/acceptable-password-ii/solve/

HTTP_USER_AGENT:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36