Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Not in one line again solution in Clear category for Acceptable Password IV by Kolia951
# Taken from mission Acceptable Password III
def is_acceptable_password(password: str) -> bool:
import re
if len(password)< 9:
dig_check = bool(re.findall(r"\d", password))
len_check = len(password) > 6
all_digits = not password.isdigit()
return bool(dig_check * len_check * all_digits)
else:
return True
if __name__ == '__main__':
print("Example:")
print(is_acceptable_password('short'))
assert is_acceptable_password("short") == False
assert is_acceptable_password("short54") == True
assert is_acceptable_password("muchlonger") == True
assert is_acceptable_password("ashort") == False
assert is_acceptable_password("notshort") == False
assert is_acceptable_password("muchlonger5") == True
assert is_acceptable_password("sh5") == False
assert is_acceptable_password("1234567") == False
assert is_acceptable_password("12345678910") == True
print("The mission is done! Click 'Check Solution' to earn rewards!")
Nov. 11, 2022
Comments: