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

Cuéntanos qué está pasando:

I don’t understand what I have to do, or what I’m doing wrong that the code doesn’t work.

This is the error that gives me:
You should use the += operator to add a random character from all_characters to the current value of password.

Tu código hasta el momento

import secrets
import string

def generate_password(length):
    # 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

# User Editable Region

    password = ''
    # Generate password

    for i in range(length):
        password  += all_characters.secrets.choice()


# User Editable Region

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 17

all_characters should be the argument of choice

No does not pass as a choice argument

show your code please

do not post a screenshot, post your code please

type or paste code here    
      password = ''
    # Generate password

    for i in range(length):
        password += choice(all_characters)

choice is a method of the secrets module, you can’t leave that out

When these things happen to me I tell myself what an idiot.
Thank you very much for the time

don’t worry, it’s programming that is hard, and the smallest typo can break everything

1 Like