View the step-by-step solution to:

Question

please see the details from the attachment, let me know if you have any question.

For this assignment you will be writing a series of programs that should be stored in their own "py" ±les. The ±lenames you should use are listed at the end of each part. When you're ±nished you should submit your program to the Assignment #7 category inside of NYU Classes. Part 1a You have been asked to write a username validation program for a small website. The website has speci±c rules on what constitutes a valid username, including: All usernames must be between 8 and 15 characters long Usernames can only contain alphabetic (a-z and A-Z) and numeric characters (0-9) - no special characters or spaces are allowed. The ±rst and last characters in a username cannot be a digit Usernames must contain at least one uppercase character Usernames must contain at least one lowercase character Usernames must contain at least one numeric character Write a program that asks the user to enter in a username and then examines that username to make sure it complies with the rules above. Here's a sample running of the program - note that you want to keep prompting the user until they supply you with a valid username: Please enter a username: foo Username must be between 8 and 15 characters. Please enter a username: fooooooooooooooooooo Username must be between 8 and 15 characters. Please enter a username: foo ooo ooo Username must contain only alphanumeric characters. Please enter a username: foooooooooo Your username must contain at least one digit Please enter a username: 1fooooooooo The ±rst / last character in your username cannot be a digit Please enter a username: foooooooo1o Your username must contain at least one uppercase character Please enter a username: Foooooooo1o Your username is valid! Hint: you will need to count the # of uppercase, lowercase and digit characters using some kind of loop. This program should be named as follows: LastNameFirstName_assign7_part1a.py (for example, "KappCraig_assign7_part1a.py") Part 1b
Background image of page 1
The company you are working for was very happy with your username validator, and now they want you to write a password validator for their website. Here are the rules for passwords: Passwords must be at least 8 characters long (but they do not have an upper limit) Passwords cannot contain the user's username (i.e. if the username is "My1stUsername" the password cannot be "abcMy1stUsername" or "My1stUsernameABC" because the username can be found inside of the password String) Passwords must be a mixture of uppercase letters (A-Z), lowercase letters (a-z), digits (0-9) and a select number of special characters (#, $, % and &). The password must contain at least one of each of these types of characters in order to be valid. You can make a copy of Part 1a and place your password validator code directly after your username validator. Here's a sample running of the program. Note that you need to continually ask the user for a password until they supply a good one. Please enter a username: MyAwesome1Name Your username is valid! Please enter a password: abc Passwords must be at least 8 characters long Please enter a password: MyAwesome1Name2 You cannot use your username as part of your password Please enter a password: 2MyAwesome1Name You cannot use your username as part of your password Please enter a password: abcabcabc Your password must contain at least one digit Please enter a password: abcabcabc1 Your password must contain at least one uppercase character Please enter a password: ABCabcabc1 Your password must contain at least one 'special' character Please enter a password: ABC***abc1 Your password contains at least one invalid character Please enter a password: ABC#$%abc1 Your password is valid! Hint: you will need to count the # of uppercase, lowercase and special characters using some kind of loop. Also, refer to the ASCII table as needed! - you may need to convert portions of your password into their ASCII locations using the ord() function! This program should be named as follows: LastNameFirstName_assign7_part1b.py (for example, "KappCraig_assign7_part1b.py") Part 2a Numerology is the "study of the purported mystical or special relationship between a number and observed or perceived events." It has been used throughout human history as a way to attach meaning to a name, object or event using mathematics. It is considered a "pseudoscience" by modern scientists since it has no basis in observable phenomena. With that said, it makes a great programming challenge so we're going to go with it! :)
Background image of page 2
Show entire document
Sign up to view the entire interaction

Top Answer

View the full answer
LastNameFirstName_assign7_part1a.py

def validateUserName(userName):
# All usernames must be between 8 and 15 characters long
if(len(userName) < 8 or len(userName) > 15):
print('Username must be between 8 and 15 characters.')...

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online