2. whats the score


#1



I am using idle in python shell 3.5.2 and I have set up the list as show in my code below. when I add the quiz numbers through lloyd["homework"] formula and then print lloyd, lloyd loses the key order as I initially wrote it. nam-homework-quizzes-tests becomes homework-quizzes-tests-name.
does any one have an explanation?


lloyd={
	"name":"Lloyd",
	"homework":[],
	"quizzes":[],
	"tests":[]
	}

lloyd["homework"]=[90,97,75,92]
>>> print (lloyd)
{'homework': [90, 97, 75, 92], 'quizzes': [], 'tests': [], 'name': 'Lloyd'}


#2

dictionary's are unordered

if you want order, use lists


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.