关于检查长度的Python简单错误需要所有字符

时间:2017-09-22 17:07:03

标签: python

import re
global points
import random
print("""
Point System:
~1 Uppercase Letter = 5 Points
~1 Lowercase Letter = 5 Points
~1 From 0-9 = 5 Points
~1 Allocated Symbol = 5 Points
~If Has All Add 10 Points
""")
points = 0

while points < 35:
    p = input("Input Password: ")


    if 8 < len(p) < 24 :
        print(len(p),"Points Added - Length")
        points += (len(p))

    else:
        print("Wrong length, it must be 8 to 24 characters")
        continue

    if re.search("[a-z]", p):
        print("5 Points Added - Lowercase Letter")
        points += 5

    if re.search("[0-9]", p):
        print("5 Points Added - Number")
        points += 5

    if re.search("[A-Z]", p):
        print("5 Points Added - Uppercase Letter")
        points += 5

    if re.search("[!$%^&()_]", p):
        print("5 Points Added - Symbols")
        points += 5

    if points == 20:
        points += 10

    print("You have {} points".format(points))

所以我是python的新手,我想创建一个密码检查器/点系统来配合它。但是当我输入密码时,即使我只是写一个大写字母,它仍然可以继续。但我想这样做,以便密码需要包含以上所有。

0 个答案:

没有答案