logo

Question detail

What is the result of the Python set comprehension {2 * x for x in {1, 2, 3}}?

Try the question, check the answer, then read the explanation to understand the curriculum point.

At a glance

MCQ

Type

practice

Style

Topic

Regular languages

Exam-style question

Try this first

What is the result of the Python set comprehension {2 * x for x in {1, 2, 3}}?.

  1. A.{1, 2, 3}
  2. B.{2, 3, 4}
  3. C.{2, 4, 6}
  4. D.{1, 4, 9}

Model answer

What a good answer should say

  • {2, 4, 6}

Explanation

Why this works

The comprehension multiplies each element of {1, 2, 3} by 2. The resulting values are 2, 4 and 6.

Common mistake

No common mistake is linked to this question yet.

Related flashcards

No flashcards are published for this page yet.

Related practice questions

No questions are published for this page yet.