logo

AQA A-Level Computer Science practice

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

Try the question first, then check the answer and practise the same topic again.

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}

Answer and explanation

Concise answer

{2, 4, 6}

Why this is correct

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

Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.

Common mistake

No common mistake is linked to this question yet.

Related flashcards

No flashcards are published for this page yet.

Related practice questions