Aprende Expresiones Regulares para Construir un Generador de Contraseñas - Paso 39

Cuéntanos qué está pasando:

I’m not understanding why it doesn’t pass the test, if it asks me for the first element lowercase, and for the second ‘[a-z]’, can someone help me get out of here?

Tu código hasta el momento

import re
import secrets
import string


def generate_password(length, nums, special_chars, uppercase, lowercase):
    # Define the possible characters for the password
    letters = string.ascii_letters
    digits = string.digits
    symbols = string.punctuation

    # Combine all characters
    all_characters = letters + digits + symbols

    while True:
        password = ''
        # Generate password
        for _ in range(length):
            password += secrets.choice(all_characters)

# User Editable Region

        constraints = [
            (nums, '[0-9]'),
            (lower(), '[a-z]')
        ]        

# User Editable Region

    return password

# new_password = generate_password(8)
# print(new_password)

pattern = '[^a-z]t'
quote = 'Not all those who wander are lost.'
# print(re.findall(pattern, quote))

Información de tu navegador:

El agente de usuario es: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36

Información del Desafío:

Aprende Expresiones Regulares para Construir un Generador de Contraseñas - Paso 39

Hi @JuanciDev

Add a new tuple to the constraints list. Use lowercase as the first item and a regex pattern that matches a single lowercase letter as the second item.

You are using

instead of what the instructions suggest.

Happy coding

Thanks, I didn’t understand why lower() doesn’t come in.

1 Like