OrderedDict Usage in Python
Level 3114 keystrokes
This creates an OrderedDict that remembers insertion order.
Python code
# OrderedDict is a dict subclass that keeps insertion order1from collections import OrderedDict2 # Starts empty3od = OrderedDict()# Keys are added in the order a, b, c4od["a"] = 15od["b"] = 26od["c"] = 3# keys() follows insertion order: prints ['a', 'b', 'c']7print(list(od.keys()))Output
['a', 'b', 'c']
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this Python code and how often they appear.
"× 6(× 4)× 4=× 4[× 3]× 3.× 1