curriculum/challenges/english/blocks/learn-regular-expressions-by-building-a-password-generator/656f04b20397d9a574cc7eb2.md
You can obtain the same result without using the compile() function. Modify your pattern variable into the literal string 'l+'. Then, change the print() call to print re.search(pattern, quote).
You should modify your pattern variable into the literal string 'l+'.
({ test: () => assert.equal(__userGlobals.get("pattern"), "l+") })
You should print re.search(pattern, quote).
({ test: () => assert.match(code, /^print\s*\(\s*re\.search\s*\(\s*pattern\s*,\s*quote\s*\)\s*\)/m) })
import re
import secrets
import string
def generate_password(length, nums, special_chars, uppercase, lowercase):
# 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
while True:
password = ''
# Generate password
for _ in range(length):
password += secrets.choice(all_characters)
constraints = [
(nums, '')
]
return password
# new_password = generate_password(8)
# print(new_password)
--fcc-editable-region--
pattern = re.compile('l+')
quote = 'Not all those who wander are lost.'
print(pattern.search(quote))
--fcc-editable-region--