Simple dictionary
Input
iterate_dict({'a': 1, 'b': 2})
Output
[('a', 1), ('b', 2)]
The items are returned as a list of tuples in insertion order.
Full lesson preview
Access key-value pairs in a dictionary and return them as a list of tuples preserving insertion order.
Problem statement
Task
Examples
Input
iterate_dict({'a': 1, 'b': 2})
Output
[('a', 1), ('b', 2)]
The items are returned as a list of tuples in insertion order.
Input format
Output format
Constraints
Samples
Input
iterate_dict({1: 2, 3: 4})
Output
[(1, 2), (3, 4)]
Numbers are returned as (key, value) tuples in the same order they were written.