Question 5

Last Updated :
Discuss
Comments

What will be the final order of keys in this code?

Python
from collections import OrderedDict

od = OrderedDict()
od['a'] = 1
od['b'] = 2
od['c'] = 3

od.move_to_end('b')

print(list(od.keys()))

['a', 'c', 'b']

['b', 'a', 'c']

['a', 'b', 'c']

['c', 'b', 'a']

Share your thoughts in the comments