In: Computer Science
Write Python code that asks the user for a password from the console and continues asking for a password until the user enters a password that has greater than 10 characters.
(language python)
Write Python code that asks the user for a password from the console and continues asking for a password until the user enters a password that has greater than 10 characters.
Validation :
import
re
x = True
while x:
p= input("Input your password: ")
if (len(p)<6 or len(p)>10):
print("Not a Valid Password")
elif not re.search("[a-z]",p):
print("Not a Valid Password")
elif not re.search("[0-9]",p):
print("Not a Valid Password")
elif not re.search("[A-Z]",p):
print("Not a Valid Password")
elif not re.search("[$#@]",p):
print("Not a Valid Password")
elif re.search("\s",p):
print("Not a Valid Password")
else:
print("Valid Password")
break
Output1:
Input your passwordR2m@10
Not a Valid Password
Output2:
Input your passwordR2m@ab1
Not a Valid Password
Output3:
Input your password Resh@12srd
Valid Password