1 00:00:01,020 --> 00:00:03,310 - [Instructor] Before we get into the syntax 2 00:00:03,310 --> 00:00:05,700 of building dictionaries in Python, 3 00:00:05,700 --> 00:00:07,240 let's talk a little bit about 4 00:00:07,240 --> 00:00:09,280 the contents of a dictionary. 5 00:00:09,280 --> 00:00:13,000 Again, a dictionary maps keys to values. 6 00:00:13,000 --> 00:00:15,500 The keys have a couple of requirements. 7 00:00:15,500 --> 00:00:17,450 They must be unique, 8 00:00:17,450 --> 00:00:21,490 and the value that is used as the key 9 00:00:21,490 --> 00:00:25,530 must be of an immutable data type. 10 00:00:25,530 --> 00:00:27,150 As you can see in the table 11 00:00:27,150 --> 00:00:28,800 that we're showing you here, 12 00:00:28,800 --> 00:00:32,590 we have some key types that are strings and integers. 13 00:00:32,590 --> 00:00:34,660 The value types can be whatever you want. 14 00:00:34,660 --> 00:00:37,290 They can be mutable or immutable. 15 00:00:37,290 --> 00:00:38,830 These are just some examples 16 00:00:38,830 --> 00:00:41,430 of potential key value pairs. 17 00:00:41,430 --> 00:00:44,080 We could map, for example, a country's name 18 00:00:44,080 --> 00:00:46,870 over to its Internet country code, 19 00:00:46,870 --> 00:00:50,340 or we could take a decimal integer value 20 00:00:50,340 --> 00:00:54,410 and map it over to its Roman numeral representation. 21 00:00:54,410 --> 00:00:57,190 Or for a state in the United States, 22 00:00:57,190 --> 00:00:58,760 we might have a list 23 00:00:58,760 --> 00:01:01,620 of corresponding agricultural products. 24 00:01:01,620 --> 00:01:04,250 You can see a number of other ones here 25 00:01:04,250 --> 00:01:06,310 in this table as well. 26 00:01:06,310 --> 00:01:08,410 Again, a couple of key things. 27 00:01:08,410 --> 00:01:10,360 The keys must be unique. 28 00:01:10,360 --> 00:01:12,800 The keys must be immutable 29 00:01:12,800 --> 00:01:14,610 so that we can be guaranteed 30 00:01:14,610 --> 00:01:18,160 to find the corresponding value again in the future. 31 00:01:18,160 --> 00:01:21,440 The values are not required to be unique 32 00:01:21,440 --> 00:01:23,930 in this right-hand column here. 33 00:01:23,930 --> 00:01:25,720 You can have whatever values you want 34 00:01:25,720 --> 00:01:28,190 for each individual key. 35 00:01:28,190 --> 00:01:31,490 The value types can be of either mutable 36 00:01:31,490 --> 00:01:34,313 or immutable types in Python.