Learn Regular Expressions by Building a Password Generator - Step 17

Tell us what’s happening:

I am unable to get
secrets.choice(all_characters += password)

to work.

Also, stop telling people to stop posting their solutions or at least let them post a solution, but with one or two characters removed. You are making it super confusing to read the help section.

Your code so far

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 range(length):
        secrets.choice(all_characters =+ password)
        pass

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36

Challenge Information:

Learn Regular Expressions by Building a Password Generator - Step 17

use the addition assignment operator

That operator is +=

to add a random character from all_characters to the current value of password

Start with password, you will add something to that.

add a random character from all_characters

secrets.choice(all_characters =+ password)

This is the correct method to use, but password will not go in the arguments. You want to select a random character from all_characters, that doesn’t involve password

The syntax will look something like this:

variable += module.function(variable)

I hope this helps!

Do you need to have pass there?

Please let us know if the above suggestions helped you. If not, please let us know of any errors you are getting in the challenge, or what could be explained better

As for the above, solutions are not allowed on the forums for a reason. Those who are just looking for a solution to move on to the next step are not learning anything. We want to make sure that users actually understand the code they are entering, if they don’t understand then they ask questions here. If solutions are allowed then they dont learn and will struggle as the lessons get harder. So, we remove the post and explain why the post was removed so they do not spoil the solution for those actually trying to learn. There are no plans to allow solutions to be posted on the forum. We appreciate the understanding

thanks