我不想找人給我解決方案。 我只是尋求一些幫助,爲什麼這不起作用。 這也是一點點比其他可用的密碼強度問題檢查密碼的強度
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