mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-19 21:09:51 +08:00
chore(curriculum): remove __locals from password generator project (#54782)
This commit is contained in:
parent
68188f1b28
commit
fd76d33485
@ -34,8 +34,7 @@ You should assign `string.ascii_letters` to your `letters` variable.
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
import string
|
||||
abc = __locals.get("letters")
|
||||
abc == string.ascii_letters
|
||||
letters == string.ascii_letters
|
||||
`))
|
||||
})
|
||||
```
|
||||
|
||||
@ -22,8 +22,7 @@ You should assign `string.digits` to your `digits` variable.
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
import string
|
||||
nums = __locals.get("digits")
|
||||
nums == string.digits
|
||||
digits == string.digits
|
||||
`))
|
||||
})
|
||||
```
|
||||
@ -39,8 +38,7 @@ You should assign `string.punctuation` to your `symbols` variable.
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
import string
|
||||
s = __locals.get("symbols")
|
||||
s == string.punctuation
|
||||
symbols == string.punctuation
|
||||
`))
|
||||
})
|
||||
```
|
||||
|
||||
@ -23,9 +23,8 @@ You should concatenate `letters`, `digits`, and `symbols` and assign the result
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
import string
|
||||
from itertools import permutations
|
||||
chars = __locals.get("all_characters")
|
||||
perms = permutations([string.ascii_letters, string.digits, string.punctuation])
|
||||
any("".join(perm) == chars for perm in perms)
|
||||
any("".join(perm) == all_characters for perm in perms)
|
||||
`))
|
||||
})
|
||||
```
|
||||
|
||||
@ -16,8 +16,7 @@ Your `generate_password` function should take a `length` parameter.
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
import inspect
|
||||
generate_psw = __locals.get("generate_password")
|
||||
sig = str(inspect.signature(generate_psw))
|
||||
sig = str(inspect.signature(generate_password))
|
||||
sig == "(length)"
|
||||
`))
|
||||
})
|
||||
|
||||
@ -26,8 +26,7 @@ You should assign `re.compile('i')` to your `pattern` variable.
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
import re
|
||||
p = __locals.get("pattern")
|
||||
p == re.compile('i')
|
||||
pattern == re.compile('i')
|
||||
`))
|
||||
})
|
||||
```
|
||||
|
||||
@ -20,8 +20,7 @@ You should modify your `pattern` variable into `re.compile('l+')`.
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
import re
|
||||
p = __locals.get("pattern")
|
||||
p == re.compile('l+')
|
||||
pattern == re.compile('l+')
|
||||
`))
|
||||
})
|
||||
```
|
||||
|
||||
@ -18,8 +18,7 @@ You should modify your `pattern` variable into `re.compile('l')`.
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
import re
|
||||
p = __locals.get("pattern")
|
||||
p == re.compile('l')
|
||||
pattern == re.compile('l')
|
||||
`))
|
||||
})
|
||||
```
|
||||
|
||||
@ -18,8 +18,7 @@ Your function should take `length`, `nums`, `special_chars`, `uppercase`, and `l
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
import inspect
|
||||
foo = __locals.get("generate_password")
|
||||
sig = str(inspect.signature(foo))
|
||||
sig = str(inspect.signature(generate_password))
|
||||
sig == '(length, nums, special_chars, uppercase, lowercase)'
|
||||
`))
|
||||
})
|
||||
|
||||
@ -17,8 +17,7 @@ Your pattern should use a character class to match a `w` followed by either `h`
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
regex = __locals.get("pattern")
|
||||
regex == "w[ha]" or regex == "w[ah]"
|
||||
pattern == "w[ha]" or pattern == "w[ah]"
|
||||
`))
|
||||
})
|
||||
```
|
||||
|
||||
@ -16,8 +16,7 @@ Your function should take default parameters.
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
import inspect
|
||||
foo = __locals.get("generate_password")
|
||||
sig = str(inspect.signature(foo))
|
||||
sig = str(inspect.signature(generate_password))
|
||||
sig == '(length=16, nums=1, special_chars=1, uppercase=1, lowercase=1)'
|
||||
`))
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user