I have used python 3.7 compiler for debugging purpose.
import re
password= input("Input your password: ")
x = True
while x:
if (len(password)<6 or len(password)>12):
break
elif not re.search("[a-z]",password):
break
elif not re.search("[0-9]",password):
break
elif not re.search("[A-Z]",password):
break
elif not re.search("[$#@]",password):
break
elif re.search("\s",password):
break
else:
print("Valid Password")
x=False
break
if x:
print("Not a Valid Password")
I have used python 3.7 compiler for debugging purpose.
Result:
Input your password: Password@123
Valid Password
need an explanation for this answer? contact us directly to get an explanation for this answer