+ 1

Dictionaries

>>> insects = {"Dragonfly": 5000, "Praying Mantis": 2000, "Fly": 120000, "Beetle": 350000} >>> insects["Grasshopper"] = 20000 >>> insects 1 - {"Dragonfly": 5000, "Praying Mantis": 2000,"Fly": 120000, "Beetle": 350000”, Grasshopper” : 20000} 2 - {"Dragonfly": 5000, "Praying Mantis": 2000,"Fly": 120000,Grasshopper” : 20000, "Beetle": 350000”} my response is 1 but response teacher is 2. who Wrong ??

3rd Jun 2017, 3:49 AM
phạm tuấn
phạm tuấn - avatar
2 ответов
+ 1
Dictionaries don't have any order to them whatsoever. When you add anything, it is inserted in random place Try this code in the playground and see for yourself.
3rd Jun 2017, 5:25 AM
Lana
Lana - avatar