I am writing a program that is supposed to take a string (the password entered by user) and test it to make sure it meets the following requirements: must contain at least one uppercase letter and one lowercase letter must start with a letter minimum of eight characters no blanks must contain at least two digits
this is what i have so far and I'm stuck getting invalid syntax errors running = True
while running:
valid = 0
password = str("Enter Password: ")
if len(p) <8:
print ("The password you entered is too short. Please try again.")
running = False
import re
#check if contains a digit
if re.search(r '\d', password):
password = valid
#check if contains uppercase letter
if re.search(r '[A-Z]', password):
password = valid
#check if contains lowercase letter
if re.search(r '[a-z]', password):
password = valid
#check if contains only letters
if re.search(r "[a-z]", password) and re.search(r "[A-Z]", password):
print ("Password must contain at least 2 digits. Please try again.")
#check if contains all lowercase letters
if password.islower():
print ("Password must contain at least 1 uppercase letter. Please try again.")
#check if contains all uppercase letters
if password.isupper():
print ("Password must contain at least 1 lowercase letter. Please try again.")
if password == valid:
print ("Valid Password")