SCWP Certification - Learn Regular Expressions by Building a Password Generator - Step 13 Bug

Here is a bug I have found:

STEP 13: “Declare a generate_password function and write all your code except the import lines inside the function body.”

  • BUG: I declare the function generate_password without the previously declared variables being inside it, and the code passes. It should not pass, because in step 14 you can see those same variables inside the function.
  • SOLUTION: You should be forced to declare the function and then put the previously declared variables inside that same function, as it appears on step 14.

Please post the code you think should not pass and a link to the Step

Seems to be the case:

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

Congratulations, your code passes. Submit your code to continue.

https://www.freecodecamp.org/learn/scientific-computing-with-python/learn-regular-expressions-by-building-a-password-generator/step-13

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

This gets a hint:

Your code has an indentation error. You may need to add pass on a new line to form a valid block of code.

The hint could be changed to “Move your code into the function”

The original instructions could also say “move” or “copy” instead of “write” since the code is already written.

if you open an issue for this we will take a look

An issue has opened for this bug and a PR is in progress, it can be followed here