← Quiz: Comprehensions and Lambda: all 15 questions
Quiz: Comprehensions and Lambda · Question 1 of 15
What does [x 2 for x in range(4)] give?
What does [x * 2 for x in range(4)] give?
- A.[2, 4, 6, 8]
- B.[0, 2, 4, 6]
- C.[0, 1, 2, 3]
- D.[0, 2, 4, 6, 8]
Answer & explanation
Correct answer: [0, 2, 4, 6]
range(4) is 0, 1, 2, 3 → doubled: 0, 2, 4, 6.
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 →