Question
Which statement about Comprehensions is the strongest interview answer?
- Comprehensions is mostly a naming style choice and has little effect on runtime behavior or design tradeoffs.
- Comprehensions exists mainly to reduce the number of files in a Python project.
- Comprehensions create derived collections concisely by combining an expression with for and optional if clauses.
- Comprehensions matters only for frontend scripting and not for backend or automation code.
Hint
Start with the core rule behind Comprehensions.
Answer and rationale
Correct answer: C. Comprehensions create derived collections concisely by combining an expression with for and optional if clauses.
Comprehensions create derived collections concisely by combining an expression with for and optional if clauses. This is the base concept interviewers commonly test first.
Track: Python