One-line conditional assignment in Python

Question:
How would you express a one-line conditional assignment in Python?

  1. x = 1 if y > 10 else 2
  2. if y > 10: x = 1 else: x = 2
  3. x = 1 when y > 10 else 2
  4. x = (y > 10) ? 1 : 2
Answer:
A - is the correct answer