Question: Question Four Write a Python program that accepts a list of passwords (separated by commas) from the user. For each password in the list, the

 Question Four Write a Python program that accepts a list ofpasswords (separated by commas) from the user. For each password in the

Question Four Write a Python program that accepts a list of passwords (separated by commas) from the user. For each password in the list, the program should call a function to verify whether or not the password is valid. Valid passwords should meet the following rules: . a. At least 8 characters and no more than 15 characters . b. Must begin with two lower case alphabets . C. At least one occurance of two consecutive uppercase letters . d. At least one occurance of a two digit number . e. Exactly one of the following special characters (#, %, @, &) Sample Interaction Enter the passwords separated by commas: chipmunk@2015, CHIPmunk@2015, chipmunk@2015, chipmunk@#20aa, chipmunk@2, chIPm, chipmunk@2015chip chipmunk@2015 matches password rules CHIPmunk@2015 does not match password rules Password must start with two lowercase letters! chipmunk@2015 does not match password rules Password must contain at least one occurance of two consecutive uppercase letters! chIPmunk@#20aa does not match password rules Password must contain exactly one occurance of one of the special characters #%@\\$ chipmunk@2 does not match password rules Password must contain at least one occurance of two consecutive digits! chIPm does not match password rulespassword=input ( "Enter the passwords separated by commas: ") pwd=list (password. split(",") ) def valid_pass (pwd) : special_char=0 num=0 upper=0 for item in pwd: if len (item)>=6: for char in item: if (char=='#' or char=s's' or char=s'@' or char=='& ') : special_char+=1 if ( char . isdigit( ) ) : num+=1 if ( char . isupper ( ) ) : upper+=1 if (special_char>=1 and num>=1 and upper>=1) : print (item, "matches password rules") else: print (item, "does not match password rules. Password must start with two lowercase letters." ) else: print(item, "does not match password rules. Password must contain at least one occurance of two cor else: print(item, "does not match password rules. Password must contain exactly one occurance of one of else: print(item, "does not match password rules. Password must contain at least one occurance of two con else: print (item, "does not match password rules. Password must be between 8 and 15 characters long.") valid_pass (pwd) File "", line 22 else: SyntaxError: invalid syntax

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!