1 00:00:01,840 --> 00:00:05,350 The slide show you learn about sets and dictionaries. 2 00:00:05,550 --> 00:00:08,790 Remember these are top elsewhere referred to as sequences. 3 00:00:09,000 --> 00:00:14,820 Well sets and dictionaries are referred to as collections because they are unordered collections of 4 00:00:14,880 --> 00:00:15,520 items. 5 00:00:15,660 --> 00:00:17,370 Let's start explaining sets. 6 00:00:17,380 --> 00:00:24,690 So this is not a collection of unique items and remember unique items not duplicate items a lot in a 7 00:00:24,690 --> 00:00:25,440 set. 8 00:00:25,980 --> 00:00:30,200 We can create a site using curly brackets just like this. 9 00:00:30,230 --> 00:00:36,400 They say faltered and I'll say all three integers in my set. 10 00:00:37,950 --> 00:00:39,960 Simple and practical use offsets. 11 00:00:39,960 --> 00:00:47,010 Now is when you have a visa that has duplicate items and you want to remove removals duplicate items 12 00:00:47,010 --> 00:00:48,070 from it. 13 00:00:48,640 --> 00:00:52,660 Let's say you have the least file these. 14 00:00:53,040 --> 00:00:58,300 We have two duplicate items and two Omega sequence of unique elements. 15 00:00:58,320 --> 00:01:01,480 You have to convert it to a set object. 16 00:01:01,680 --> 00:01:05,530 We can't convert a lease to a said object using the said function. 17 00:01:05,610 --> 00:01:09,750 When you do that duplicate will be removed automatically. 18 00:01:10,260 --> 00:01:18,200 So we are sort of updating our file of this variable with the new value in this line of code. 19 00:01:18,300 --> 00:01:25,490 This new value will be a set that is generated by converting those least objects to a set object. 20 00:01:25,530 --> 00:01:32,280 So you know printing the file is Wheler reveal that duplicate items have been removed and we now have 21 00:01:32,280 --> 00:01:34,620 a set object not a list anymore. 22 00:01:34,860 --> 00:01:40,620 That is because we converted our solutions to a set but don't believe me hunch. 23 00:01:40,650 --> 00:01:43,640 The type of the object always. 24 00:01:44,360 --> 00:01:53,360 So if you want to retain your data type you can convert the set back to a list using the list function 25 00:01:53,370 --> 00:01:54,080 this time. 26 00:01:54,300 --> 00:02:02,860 So file this equals list and we pass the said object to the list function more data types. 27 00:02:02,860 --> 00:02:05,470 Now dictionaries. 28 00:02:05,670 --> 00:02:08,810 Well let's try to explain them by making a comparison with this. 29 00:02:08,830 --> 00:02:16,330 So in the case of this we were able to access items using indexes for dictionaries we can access items 30 00:02:16,330 --> 00:02:20,590 using indexes clear explicitly by us. 31 00:02:20,590 --> 00:02:25,400 Here is a dictionary called my dictionary file dict. 32 00:02:25,900 --> 00:02:33,400 We use curly brackets to define a dictionary and there were either index or column the corresponding 33 00:02:33,400 --> 00:02:34,170 item. 34 00:02:34,180 --> 00:02:41,530 So don't forget that each item has its own data type so if you use quotes for an item that matches that 35 00:02:41,530 --> 00:02:48,940 particular item a string and so on the items in this case are 2015 2017. 36 00:02:48,940 --> 00:02:55,250 In 2019 they are referred to as the values so remember values. 37 00:02:55,250 --> 00:02:57,730 Why are we talking about dictionaries. 38 00:02:57,790 --> 00:02:58,640 Indexes are. 39 00:02:58,690 --> 00:03:04,060 Last year this year and next year they are referred to as keys. 40 00:03:04,390 --> 00:03:10,200 So what we are doing here is an object constructed by pairs of keys and values. 41 00:03:10,540 --> 00:03:16,520 Now in the case of we sent up also we were able to access items using the default indexes. 42 00:03:16,720 --> 00:03:23,890 In the case of dictionaries you can access the dictionary values using the corresponding keys that will 43 00:03:23,890 --> 00:03:27,670 return a value attached to the U key.