The program asks for a password, then asks again to confirm it. If the passwords don’t match or the rules are not fulfilled, prompt again. Your program should include a function that checks whether a password is valid.
What do I need to add in order to make the program ask the user like the instruction above? Help pls
enter def isValid(password):
if (len(password) < 8 or len(password) > 15):
return False
arr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
for i in password:
if i in arr:
count = 1
break
if count == 0:
return False
for i in range(65, 91):
if chr(i) in password:
count = 1
if (count == 0):
return False
if (True):
count = 0
for i in range(90, 123):
if chr(i) in password:
count = 1
if(count == 0):
return False
return True
password1 = "mDampac1999"
if (isValid([i for i in password1])):
print("Corect Password")
else:
print("Invalid Password")
password2 = "Astayuno1738"
if (isValid([i for i in password2])):
print("Correct Password")
else:
print("Invalid Password")code here