+1 (315) 557-6473 

Program To Build a Program That Checks If the Password Meets The Required Requirements In Python Assignment Solution.


Write a program to build a program that checks if the password meets the required requirements in python

Requirements and Specifications

This week's assignment involves writing a Python program to determine whether a password exactly meets the following requirements for a secure password: The length of the password must greater than some minimum length and less than some maximum. You should decide on the minimum (at least 6) and maximum (at least 15) allowable lengths. It must not include any spaces. It must contain at least one digit It must contain at least one alphabetic character. Your program must contain at least three functions: one function to check that the password is the proper length a second function to check whether it contains the required number of characters/digits. Hint: to determine whether it contains at least one digit and one alphabetic character, use a loop and the isalpha or isdigit methods. a third function to verify that it does not contain the prohibited character (space). Your program should prompt the user for the candidate password and then each function and display either that the password is valid or the first reason it is invalid. You cannot use Regular Expressions (RE) ! ****Break**** For context, this is an entry level class so the code cant be too advanced. Also, last week we learned loops and this week we are covering strings.
Source Code
def check_length(password):
return 6 <= len(password) <= 15
def check_required_symbols(password):
has_digit = False
has_alpha = False
for c in password:
if c.isalpha():
has_alpha = True
if c.isdigit():
has_digit = True
return has_digit and has_alpha
def check_prohibited_symbols(password):
for c in password:
if c == ' ':
return False
return True
if __name__ == '__main__':
password = input('Please, input password to check: ')
if not check_length(password):
print('Password has wrong length')
elif not check_required_symbols(password):
print('Password does not have a digit or letter')
elif not check_prohibited_symbols(password):
print('Password contains spaces')
print('Password is valid')