我不想找人给我解决方案。 我只是寻求一些帮助,为什么这不起作用。 这也是一点点比其他可用的密码强度问题检查密码的强度
def password(pwd):
if len(pwd) >= 10:
is_num = False
is_low = False
is_up = False
for ch in pwd:
if ch.isdigit():
is_num = True
if ch.islower():
is_low = True
if ch.isupper():
is_up = True
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert password(u'A1213pokl') == False, "1st example"
assert password(u'bAse730onE4') == True, "2nd example"
assert password(u'asasasasasasasaas') == False, "3rd example"
assert password(u'QWERTYqwerty') == False, "4th example"
assert password(u'123456123456') == False, "5th example"
assert password(u'QwErTy911poqqqq') == True, "6th example"
什么是你的问题? – bereal 2014-10-31 12:21:36
你的'密码'函数不会返回任何东西。它总是会返回None。 – CoryKramer 2014-10-31 12:22:48
你还没有说明你在寻找什么功能。你检查返回值,但没有任何。请描述函数调用的期望结果。 – Mike 2014-10-31 12:23:43