赞
踩
while True: try: str1 = input() result = 0 # 密码长度 if len(str1) <= 4: result += 5 elif len(str1) >= 8: result += 25 else: result += 10 word_uper = 0 word_lower = 0 num = 0 signal = 0 # 遍历字符串 for item in str1: if item.islower(): word_lower += 1 elif item.isupper(): word_uper += 1 elif item.isdigit(): num += 1 else: signal += 1 # 判断字母情况 if word_lower == 0 and word_uper == 0: result += 0 elif word_lower > 0 and word_uper > 0: result += 20 else: result += 10 # 判断数字情况 if num == 0: result += 0 elif num == 1: result += 10 else: result += 20 # 判断符号情况 if signal == 0: result += 0 elif signal == 1: result += 10 else: result += 25 # 判断奖励情况 if word_lower > 0 and word_uper > 0 and num > 0 and signal > 0: result += 5 if (word_lower > 0 and num > 0 and signal > 0) or (word_uper > 0 and num > 0 and signal > 0): result += 3 else: result += 2 # 评分标准 if result >= 90: print('VERY_SECURE') if 80 <= result < 90: print('SECURE') if 70 <= result < 80: print('VERY_STRONG') if 60 <= result < 70: print('STRONG') if 50 <= result < 60: print('AVERAGE') if 25 <= result < 50: print('WEAK') if 0 <= result < 25: print('VERY_WEAK') except: break
word_uper
,word_lower
,num
,signal
,分别表示大写字母、小写字母、数字、符号四种字符的个数;胡萝卜
编辑时间:2022年1月21日20:06:12
我不知道将去向何方,但我已在路上! |
---|
时光匆匆,虽未曾谋面,却相遇于斯,实在是莫大的缘分,感谢您的到访 ! |
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。