Dictionaries | SoloLearn: Learn to code for FREE!

+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 ??

6/3/2017 3:49:11 AM

phạm tuấn

2 Answers

New Answer

+1

your teacher is wrong. it is Like the append function.

+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.