Back to Freecodecamp

Step 12

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

latest727 B
Original Source

--description--

Although the effect might seem equal to random.choice(), secrets ensures you the most secure source of randomness that your operating system can provide.

Now, delete your two print() calls.

--hints--

You should delete your two print() calls.

js
({ test: () => assert.isFalse( /^print/m.test(code)) })

--seed--

--seed-contents--

py
import secrets
import string


# 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--
print(all_characters)
print(secrets.choice(all_characters))
--fcc-editable-region--