I'm messing around with dictionaries for the first time and something's coming up that's confusing me. Using two lists to create a new dictionary, the order of the list terms for the key part seems to be wrong. Here's my code:
list1 = ["a", "b", "c", "d"]
list2 = [5,3,7,3]
newDict = {list1[c]: number for c, number in enumerate(list2)}
print(newDict)
This gives me the following:
{'a': 5, 'd': 3, 'c': 7, 'b': 3}
Why is this happening? Surely the 'c' value getting terms from the list is going from 0 and upwards, so why isn't it creating the dictionary with the letters in the same order?
Thanks.