Back to Freecodecamp

Step 16

curriculum/challenges/english/blocks/learn-regular-expressions-by-building-a-password-generator/65648eefbee2014f5815f4ba.md

latest831 B
Original Source

--description--

Below your new variable, add a comment saying Generate password.

--hints--

You should add the provided comment.

js
({ test: () =>
  {
    const transformedCode = code.replace(/\r/g, "");
    const generate_pw = __helpers.python.getDef("\n"+transformedCode, "generate_password");
    const {function_body} = generate_pw;     
    assert(function_body.match(/#\s*Generate password/));
  }
})

--seed--

--seed-contents--

py
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
--fcc-editable-region--    
    password = ''
    
--fcc-editable-region--