Question: Python 3.6.1 ****Do not use import re**** Password validator. Write a PYTHON program to check the validity of a password chosen by a user. To
Python 3.6.1 ****Do not use import re****
Password validator. Write a PYTHON program to check the validity of a password chosen by a user.
To be considered valid, a password
a) contains at least 1 letter between [A-Z],
b) contains at least 1 letter between [a-z],
c) contains at least 1 number between [0-9],
d) contains at least 1 special character from [$#@],
e) has a minimum length of 6 characters, and
f) has a maximum length of 12 characters.
Your program will consist of two user-defined functions: validate(s) and main(). The validate() function implements the validation procedure described above. The parameter (or input) to the function is a string s. If s fits the above criteria, print valid. Otherwise, print not valid. The main() function drives the program and has been written for you. Your goal is to write the validate() function.
This is the code. Please complete it and use the provided code below.
def validate(s): ''' Checks whether the string s fits the criteria for a valid password. '''
def main(): ''' The program driver. '''
# set cmd to anything except quit() cmd = ' ' # process the user commands cmd = input(' > ') while cmd != 'quit': password = cmd validate(password) cmd = input(' > ')
main()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
