fix(curriculum): test in password generator project, step 54 (#54804)

This commit is contained in:
Dario-DC
2024-05-22 11:13:25 +02:00
committed by GitHub
parent 5ac73c6e07
commit 5a44a9dbe2
2 changed files with 9 additions and 2 deletions

View File

@@ -11,10 +11,16 @@ After your new comment, write a `for` loop to iterate over the `constraints` lis
# --hints--
You should write a `for` loop to iterate over the `constraints` list with `constraint` and `pattern`.
You should write a `for` loop to iterate over the `constraints` list.
```js
assert.match(code, /for\s+constraint\s*,\s*pattern\s+in\s+constraints\s*:/)
({ test: () => assert(runPython(`_Node(_code).find_function("generate_password").find_whiles()[0].find_bodies()[0].find_for_loops()[1].find_for_iter().is_equivalent("constraints")`)) })
```
Your `for` loop should use `constraint` and `pattern` as the loop variables to iterate over the `constraints` list.
```js
({ test: () => assert(runPython(`_Node(_code).find_function("generate_password").find_whiles()[0].find_bodies()[0].find_for_loops()[1].find_for_vars().is_equivalent("constraint, pattern")`)) })
```
# --seed--

View File

@@ -51,6 +51,7 @@ def generate_password(length, nums, special_chars, uppercase, lowercase):
--fcc-editable-region--
# Check constraints
for constraint, pattern in constraints:
pass
--fcc-editable-region--
return password