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