|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 发狂的战斗机 于 2017-8-6 17:42 编辑
- password = input('请输入需要检查的密码组合:')
- length = len(password)
- initial = password[0]
- intCount = 0 #记录数字的个数
- strCount = 0 #记录str元素个数
- reCount =0 #记录特殊元素的个数
- characterre =r'''~!@#$%^&*()_=-/,.?<>;:[]{}\|'''
- while (password.isspace() or length ==0):
- password = input('您的输入密码为空(或空格),请重新输入:')
- length = len(password)
- for i in password:
- if i.isdigit(): #判断i是否是int
- intCount += 1
- continue
- elif i.isalpha(): #判断i是不是str
- strCount += 1
- continue
- elif i in characterre: #判断i是不是characterre中的特殊符号
- reCount += 1
- continue
- if length <8:#低级的判断
- print('您的密码安全级别为:低')
- elif password.isdigit() or password.isalpha():
- print('您的密码安全级别为:低')
- elif 16<=length and initial.isalpha() and (intCount > 0 and strCount > 0 and reCount > 0):
- print('您的密码安全级别为:高')
- print('请继续保持')
- elif (8<=length) and ((intCount > 0 and strCount > 0 and reCount == 0 ) or (intCount > 0 and reCount > 0 and strCount == 0) or (strCount >0 and reCount > 0 and intCount == 0)):
- print('您的密码安全级别为:中')
- else:
- print('你的密码啥也不是')
- if not (16<=length and initial.isalpha() and (intCount > 0 and strCount > 0 and reCount > 0)):
- print('''请按以下方式提升您的密码安全级别:
- 1.密码必须有数字、字母及特殊字符三种组合
- 2.密码只能由字母开头
- 3.密码的长度不能低于16位''')
复制代码
要求1:用14讲前的内容
eg: 确实现在谈效率太早了。多谢版主和小甲鱼老师的回复
|
|