Python Forum

Full Version: Program regarding Password check need assistance
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
import re
import random
points = 0
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
""")


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))
break
okay so the point system of my program works however i am trying to implement a validation system where if the user enters a password and that password doesn't contain all the characters allocated e.g Uppercase,Lowercase,Number or symbol it doesn't show the points it just says try again until they put all of it
In this fragment, the value 8 isn't assigned to anything:
if 8 <= len(p) < 24 :
print(len(p),"Points Added - Length")
points += (len(p))
Oops just ignore the message my fault :(