0

Make a Dictionary

How can I make a dictionary with the version 3.5.2? Thanks!

5th Nov 2016, 8:54 PM
Alvaro Mh
Alvaro Mh - avatar
4 Answers
+ 1
d1 = dict() #empty dictionary, without items d2 = {"a": 1, "b": 2} #dictionary with items dictionary creating is the same in python 2 and 3
5th Nov 2016, 8:59 PM
Demeth
Demeth - avatar
0
Is that the whole structure, Demeth?
5th Nov 2016, 9:03 PM
Alvaro Mh
Alvaro Mh - avatar
0
examples of most common cases, when you create empty dictionary and fill it later or when you initialize some key:value pairs before. you are free to structurize your dictionary as you want, it's very flexible structure. the syntax and how to work with dictionaries you can learn in this course, where to use it and what to store there depends on you and your program
5th Nov 2016, 9:10 PM
Demeth
Demeth - avatar
0
Well, thanks a lot Demeth!
5th Nov 2016, 9:24 PM
Alvaro Mh
Alvaro Mh - avatar