1 00:00:00,150 --> 00:00:09,570 We can use the identity operators in or not in to check whether a key exists in the dictionary. 2 00:00:09,740 --> 00:00:17,230 So let's check if the key is to exists in dictionary dict 1. 3 00:00:18,230 --> 00:00:19,320 Then execute. 4 00:00:19,430 --> 00:00:27,540 So it has returned the Boolean value to use the identity operator not in dict 1. 5 00:00:27,620 --> 00:00:32,930 It should return finds the key to exists in the dictionary dict 1 6 00:00:35,680 --> 00:00:43,300 we can use the comparison operators to check whether 2 dictionaries contains the same items. 7 00:00:43,390 --> 00:00:55,220 So let's see if the dictionaries dict 1 and Dick do have the same items and not this is false. 8 00:00:55,250 --> 00:01:07,790 These are the items in to let us also verify the not equal to operator not equal to the 2. 9 00:01:07,840 --> 00:01:14,230 So this is true because dict 1 and 2 have different items 10 00:01:17,670 --> 00:01:21,240 looping items in the dictionary. 11 00:01:21,240 --> 00:01:27,870 A for loop can be used to iterate over the elements in the dictionary. 12 00:01:27,870 --> 00:01:30,760 So here we have the dictionary dict. 13 00:01:30,770 --> 00:01:38,590 1 and let us now display the keys present in this dictionary. 14 00:01:38,790 --> 00:01:51,110 So using the keys method so the output is a list of keys indicate one now using a for loop. 15 00:01:51,120 --> 00:01:56,460 I want to display the keys existing in the dictionary dict 1. 16 00:01:56,610 --> 00:02:00,850 So for that let's put this statement like this. 17 00:02:00,950 --> 00:02:08,180 For every element in dict one dart keys. 18 00:02:08,520 --> 00:02:18,940 So for every element in this list I want to print the element that is sticky. 19 00:02:18,960 --> 00:02:26,410 So let us now execute this after you've executed this line. 20 00:02:26,530 --> 00:02:32,030 You have all the keys displayed in the output. 21 00:02:33,300 --> 00:02:44,400 Similarly we can display the while using dict one by either rating through did the elements in the dictionary 22 00:02:44,430 --> 00:02:46,870 dict 1 using a for loop. 23 00:02:47,190 --> 00:02:56,930 So for that let's first display the values in dictionary 1 using the values method. 24 00:02:57,680 --> 00:03:03,280 So here we have a list of these values in the dictionary dict 1. 25 00:03:03,470 --> 00:03:18,620 Now using the for loop lets I did it over these elements dict 1 dot so far y you indicate 1 dot 1 use 26 00:03:19,190 --> 00:03:29,290 in devalue execute this and now you have all the values displayed using the for loop. 27 00:03:29,560 --> 00:03:36,610 You can also display the key value pairs in the dictionary using the for loop. 28 00:03:36,700 --> 00:03:41,450 So for that default loop statement should be fought. 29 00:03:41,530 --> 00:03:50,450 Item In dict 1 dot items please don't worry too much about code syntax. 30 00:03:50,500 --> 00:03:57,400 We will have a separate tutorial on for loop in the upcoming sessions for now. 31 00:03:57,400 --> 00:04:10,840 Just follow along so for item in dict one dot items but in item and this fourth statement would return 32 00:04:10,920 --> 00:04:16,090 a tuples of the key value pairs. 33 00:04:16,380 --> 00:04:21,720 And this is a boat item rating or dictionaries using for loop.