chore(curriculum): remove __locals from password generator project (#54782)

This commit is contained in:
Ilenia 2024-05-14 14:39:34 +02:00 committed by GitHub
parent 68188f1b28
commit fd76d33485
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 11 additions and 22 deletions

View File

@ -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
`))
})
```

View File

@ -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
`))
})
```

View File

@ -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)
`))
})
```

View File

@ -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)"
`))
})

View File

@ -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')
`))
})
```

View File

@ -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+')
`))
})
```

View File

@ -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')
`))
})
```

View File

@ -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)'
`))
})

View File

@ -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]"
`))
})
```

View File

@ -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)'
`))
})