Question: SYNTAX ERROR with the following code: I bolded and underlined where It keeps saying my error is at...I tried to get in touch with the

SYNTAX ERROR with the following code: I bolded and underlined where It keeps saying my error is at...I tried to get in touch with the tutor that helped me with this but I could not find how to send a message to them :(

 

import re

def printWelcome():
    print("Welcome to the Password checker program!")
    print("This program checks if your string meets the following criteria:")
    print("- Password length should be at least 10 characters")
    print("- Password should have at least two capital letters")
    print("- Password should have at least one lowercase letter")
    print("- Password should have at least two special characters")
    print("- Password should have at least one number")

def passwordChecker(password):
    # Check password length
    if len(password) < 10:
        return False

    # Check for at least two capital letters
    if len(re.findall(r'[A-Z]', password)) < 2:
        return False

    # Check for at least one lowercase letter
    if len(re.findall(r'[a-z]', password)) < 1:
        return False

    # Check for at least two special characters
    if l..!@#$%^&*(),.?":{}|<>]', password)) < 2:
        return False

    # Check for at least one number
    if len(re.findall(r'[0-9]', password)) < 1:
        return False

    return True

def main():
    printWelcome()
    while True:
        password = input("Enter a string to continue, q to quit: ")
        if password == "q":
            break
        elif passwordChecker(password):
            print(password + " meets the criteria")
        else:
            print(password + " does not meet the criteria")
    print("Thank you!")

if __name__ == '__main__':
    main()


Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!