← Quiz: Comprehensions and Lambda: all 15 questions
Quiz: Comprehensions and Lambda · Question 11 of 15
What does this print? (code)
What does this print?
names = ["Asha", "Ravi", "Neha"]
marks = [91, 78, 85]
print(dict(zip(names, marks))["Ravi"])
- A.Ravi
- B.78
- C.('Ravi', 78)
- D.KeyError
Answer & explanation
Correct answer: 78
zip pairs the items by position, and dict turns the pairs into keys and 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 →