About the dictionaries I read that they return keys in the insertion order but in the following code when I print dict it should return {1.0:4, 5.0:1, 3.0:3} but result is different. It returns the values in ascending order of keys. I want exactly the same order because I have add elements in the corresponding list b. If order changes I can not deal b list.
`a = [1.0, 1.0, 1.0, 1.0, 5.0, 3.0,3.0,3.0]
b=[2, 2, 2, 2, 1, 5, 5, 5]
dict ={}
for val in a:
if val not in dict:
dict[val] = 1
else:
dict[val] += 1
print(dict)`