Python for JavaScript Developers — Practice quiz
Untimed. Answers are graded when you submit, with explanations and spaced-repetition scheduling.
- Question 1easy
In Python, how do you read the value for key 'name' from a dict `user`?
- Question 2easy
Which Python expression is equivalent to JS `words.map(w => w.toUpperCase())`?
- Question 3easy
What is Python's equivalent of JavaScript's `null`?
- Question 4medium
Which is the idiomatic way to test that a variable equals None?
- Question 5medium
Which values are FALSY in Python? (Select all that apply)
Select all that apply.
- Question 6medium
What does `nums[-1]` return for `nums = [10, 20, 30]`?
- Question 7medium
What is the effect of `temperature` in `def call(prompt, model='gpt-4o-mini', temperature=0.7)`?
- Question 8hard
Why is `def add_tag(tag, tags=[])` a classic Python bug?
- Question 9medium
In `def find(id: str) -> Optional[Chunk]:`, what does the return type mean?
- Question 10medium
What does the `@dataclass` decorator give you?
- Question 11hard
What do `5 / 2` and `5 // 2` evaluate to in Python 3?
- Question 12medium
What is the purpose of a Python virtual environment (venv)?
- Question 13medium
What one-word Python literal syntax `{...}` builds a collection of unique, unordered items (JS Set)?
- Question 14hard
Name the guard line (paraphrase ok) that makes code run only when a file is executed directly, not imported.