+ 1

List({Dictionaries})

I have no idea why my list goes out of order when I make my dictionary a list and print it!! Please Help Me! nums = {“a” , ”b” , ”c” , ”d”} print (list(nums)) Prints: ['b', 'c', 'a', 'd']

20th Nov 2019, 7:30 PM
Warsin
Warsin - avatar
3 odpowiedzi
+ 7
it's not a dictionary...you've got a "set" ...unordered.
20th Nov 2019, 7:42 PM
rodwynnejones
rodwynnejones - avatar
+ 1
A dictionary must have key:value pairs.
21st Nov 2019, 6:29 AM
Njeri
Njeri - avatar
0
thanks dude I was so confused until i learned about sets xd
21st Jan 2020, 12:47 PM
Warsin
Warsin - avatar