Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(Using Python)Part 1b The company you are working for was very happy with your u

ID: 3760125 • Letter: #

Question

(Using Python)Part 1b

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.

Hint: you will need to count the # of uppercase, lowercase and special characters using some kind of loop. Also, [images/ascii.png refer to the ASCII table as needed!] - you may need to convert portions of your password into their ASCII locations using the ord() function!

Explanation / Answer

username=input("please enter a username")
password=input("please enter a password:")

def is_a password(password):
    count_uppercase, count_lowercase= 0, 0
    for characters1 in password:
        if characters1.isupper():
        count_uppercase += 1
        if characters1.islower():
        count_lowercase += 1
    is_password is good = True
    if len(password) <= 7:
        print "Passwords must be at least 8 characters long"
    is_password is good = False
    if count_uppercase < 1:
        print "Your password must contain at least one uppercase character"
        is_password is good = False
   if password.isalnum():
          print "Your password must contain at least one 'special' character"
        is_password is good = False
while (username == password):
print "You cannot use your username as part of your password"
         is_password is good = False

    print "Your password is valid!"
return is_password is good