QuestionQ287

VerifiedData Collections – Tuples, Dictionaries, Lists, and Strings

What does the following snippet output?

Question Image

Explanation

Python dictionaries preserve insertion order, so the values for keys '1' and '2' are processed in that sequence. Index 1 selects the second item in each tuple, producing 2 followed directly by 1 because end='' adds no separator.

Learn more

Community Discussion

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