QuestionQ5

VerifiedData Collections – Tuples, Dictionaries, Lists, and Strings

Which code should replace the comment to produce the expected output?

Expected output:

Question Image

Code:

Question Image

Explanation

Each dictionary value is a one-element tuple containing its associated key value. Accessing index 0 of k returns the contained string, so print(k[0]) outputs a, b, and c on separate lines.

Community Discussion

No comments yet. Be the first to start the discussion!