|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 施工队员 于 2020-2-18 18:47 编辑
请问我这样写代码跟答案代码看起来差别很大,在功能上会有什么影响吗?
- temp = input("请输入需要检查的密码组合:")
- length = len(temp)
- if length <= 8:
- print('''您的密码安全评定级别为:低
- 请按照以下方式提升您的密码安全级别:
- 1.密码必须由数字、字母及特殊字符三种组合
- 2.密码只能由字母开头
- 3.密码长度不能低于16位''')
- elif temp.isnumeric():
- print('''您的密码安全评定级别为:低
- 请按照以下方式提升您的密码安全级别:
- 1.密码必须由数字、字母及特殊字符三种组合
- 2.密码只能由字母开头
- 3.密码长度不能低于16位''')
- elif temp.isalpha():
- print('''您的密码安全评定级别为:低
- 请按照以下方式提升您的密码安全级别:
- 1.密码必须由数字、字母及特殊字符三种组合
- 2.密码只能由字母开头
- 3.密码长度不能低于16位''')
- elif 8 <= length <= 16:
- print('''您的密码安全评定级别为:中
- 请按照以下方式提升您的密码安全级别:
- 1.密码必须由数字、字母及特殊字符三种组合
- 2.密码只能由字母开头
- 3.密码长度不能低于16位''')
- elif temp.isalnum():
- print('''您的密码安全评定级别为:中
- 请按照以下方式提升您的密码安全级别:
- 1.密码必须由数字、字母及特殊字符三种组合
- 2.密码只能由字母开头
- 3.密码长度不能低于16位''')
- elif temp.startswith('1') or temp.startswith('2') or temp.startswith('3') or \
- temp.startswith('4') or temp.startswith('5') or temp.startswith('6') or \
- temp.startswith('7') or temp.startswith('8') or temp.startswith('9') or \
- temp.startswith('~') or temp.startswith('!') or temp.startswith('@') or \
- temp.startswith('#') or temp.startswith('
- ) or temp.startswith('%') or \
- temp.startswith('^') or temp.startswith('&') or temp.startswith('*') or \
- temp.startswith('(') or temp.startswith(')') or temp.startswith('_') or \
- temp.startswith('=') or temp.startswith('-') or temp.startswith('/') or \
- temp.startswith(',') or temp.startswith('.') or temp.startswith('?') or \
- temp.startswith('<') or temp.startswith('>') or temp.startswith(';') or \
- temp.startswith(':') or temp.startswith('[') or temp.startswith(']') or \
- temp.startswith('{') or temp.startswith('}') or temp.startswith('|') or \
- temp.startswith('\\'):
- print('''您的密码安全评定级别为:中
- 请按照以下方式提升您的密码安全级别:
- 1.密码必须由数字、字母及特殊字符三种组合
- 2.密码只能由字母开头
- 3.密码长度不能低于16位''')
- else:
- print('''您的密码安全级别评定为:高
- 请继续保持''')
复制代码
|
|