← Quiz: Design a News Feed: all 10 questions
Quiz: Design a News Feed · Question 4 of 10
What does this print? (code)
What does this print?
pushed = [(5, "a"), (2, "b")]
pulled = [(4, "c"), (1, "d")]
feed = sorted(pushed + pulled, reverse=True)[:3]
print([x for t, x in feed])
- A.['a', 'b', 'c']
- B.['a', 'c', 'b']
- C.['c', 'a', 'b']
- D.['a', 'c', 'd']
Answer & explanation
Correct answer: ['a', 'c', 'b']
Merged by time, newest first: 5, 4, 2.
Can you get the rest right without peeking?
Take the timed Quiz: Design a News Feed quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →