×
Samples Blogs Make Payment About Us Reviews 4.9/5 Order Now

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

June 28, 2024
Martin Jonas
Martin Jonas
🇦🇺 Australia
Python
Dr. Martin Jonas, PhD in Computer Science from Southern Cross University, Australia. With 4 years of experience in Python assignments, I offer expert guidance and support to help you excel in your programming projects.
Key Topics
  • Instructions
    • Objective
  • Requirements and Specifications
Tip of the day
Use Python libraries effectively by importing only what you need. For example, if you're working with data, using libraries like pandas and numpy can save time and simplify complex tasks like data manipulation and analysis.
News
In 2024, the Biden-Harris Administration has expanded high-dosage tutoring and extended learning programs to boost academic achievement, helping programming students and others recover from pandemic-related setbacks. These initiatives are funded by federal resources aimed at improving math and literacy skills​

Instructions

Objective

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 assignment 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') else: print('Password is valid')

Similar Samples

Welcome to ProgrammingHomeworkHelp.com, your one-stop solution for all programming assignments. Whether you're struggling with Java, Python, C++, or any other language, our expert team is here to assist. With tailored solutions and timely delivery, we ensure your academic success. Trust us with your programming challenges and experience hassle-free learning.