← Quiz: Comprehensions and Lambda: all 15 questions
Quiz: Comprehensions and Lambda · Question 6 of 15
What does this print? (code)
What does this print?
print({x % 3 for x in range(7)})
- A.{0, 1, 2}
- B.[0, 1, 2, 0, 1, 2, 0]
- C.{0, 1, 2, 3}
- D.An error
Answer & explanation
Correct answer: {0, 1, 2}
A set comprehension keeps unique values.
Can you get the rest right without peeking?
Take the timed Quiz: Comprehensions and Lambda quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →