1 00:00:00,330 --> 00:00:05,290 Now we come to the reversing the letter laced with the sword. 2 00:00:06,060 --> 00:00:13,920 Now the sword they let those individuals on, do we also need to support them based on the own strength 3 00:00:14,160 --> 00:00:21,510 by assigning them not find the key after the matter has been called on all the letters so that they 4 00:00:21,510 --> 00:00:22,740 are all indexers? 5 00:00:22,950 --> 00:00:26,680 The sword metal source, the letter based on the numerical index. 6 00:00:26,880 --> 00:00:33,930 Now usually this function, swords, whatever list it's called on in the alphabetical or numerical order, 7 00:00:34,290 --> 00:00:40,470 which is known as ascending order, not the soft items in the descending order, which is in reverse 8 00:00:40,530 --> 00:00:46,490 alphabetical or reverse numerical order we pass through for this assortment also reveals document. 9 00:00:46,800 --> 00:00:53,790 Hence, if we go back to our program here, we are passing divorcées through, after which we are seeing 10 00:00:53,790 --> 00:00:55,440 frequency to Orestiada. 11 00:00:55,440 --> 00:00:58,100 The index of frequency one is equal to. 12 00:00:58,110 --> 00:01:02,630 We are using the joint with frequency to let the discharge frequency one. 13 00:01:02,820 --> 00:01:08,760 Then we recall that at this point the frequency to letters is a dictionary that stored the integer frequency 14 00:01:08,760 --> 00:01:13,620 count as its key and the list of letter strings as its values. 15 00:01:13,860 --> 00:01:20,220 The little strings at the key frequency are being sorted, not the frequency to let the dictionary itself. 16 00:01:20,590 --> 00:01:23,730 Dictionaries cannot be sorted because they have no audio. 17 00:01:24,090 --> 00:01:28,620 There is no first or last evalu period as there is for the list items. 18 00:01:29,100 --> 00:01:36,480 OK, notice that over here the string for some key was also in the reverse order of A2 on order because 19 00:01:36,480 --> 00:01:38,420 the loop executed that evaluable. 20 00:01:38,460 --> 00:01:42,500 It looked like multiple values for a particular keep. 21 00:01:42,510 --> 00:01:47,650 The joint method then calls though, or changes the list of string into a single string. 22 00:01:47,940 --> 00:01:54,000 So, for example, if you're having all the frequency of the index, what is B and W, which will be 23 00:01:54,000 --> 00:01:59,530 joined us BWB and then we move on to sorting the dictionary list by frequency. 24 00:02:00,000 --> 00:02:06,600 So if the fourth step over here is to get the frequency, order is to sort the strings from the frequency 25 00:02:06,600 --> 00:02:12,010 to let Oresteia dictionary by the frequency count and to convert the string to the list. 26 00:02:12,300 --> 00:02:18,210 So keep in mind that because the key value in dictionary are unordered, a list of values of all the 27 00:02:18,210 --> 00:02:23,970 keys or values in a dictionary will be a list of items in random order. 28 00:02:24,120 --> 00:02:26,690 This means that we will need to sort this list. 29 00:02:26,940 --> 00:02:33,840 So using over here the keys, values and items dictionary method now coming to the keys, values and 30 00:02:33,840 --> 00:02:35,370 items, dictionary method. 31 00:02:35,370 --> 00:02:42,630 Each convert part of a dictionary into a non dictionary and after the dictionary is converted to another 32 00:02:42,900 --> 00:02:46,710 type, it can be converted into a list using the list function. 33 00:02:46,890 --> 00:02:51,120 So if we want to check all that, we will enter something in the interactive shell here. 34 00:02:51,480 --> 00:02:51,860 We will. 35 00:02:51,880 --> 00:03:09,530 This time is equal to see guides then comma C box C for and C mice in my c e as also for for example. 36 00:03:10,020 --> 00:03:17,430 Then we take standard E we have the dictionary uses cats, dogs, mice. 37 00:03:17,670 --> 00:03:20,010 OK, then we take your list. 38 00:03:20,850 --> 00:03:23,280 Spambot keys. 39 00:03:23,700 --> 00:03:25,830 We have your cats, dogs, mice again. 40 00:03:26,130 --> 00:03:32,640 And if we check list spambot values we get the values. 41 00:03:33,300 --> 00:03:38,670 Now to get the list of values in a dictionary, we use the Keys method to return the dictionary object 42 00:03:38,670 --> 00:03:45,210 that we can then pass to the list function a similar dictionary method name values return a dictionary 43 00:03:45,210 --> 00:03:46,250 values object. 44 00:03:46,680 --> 00:03:51,790 These examples gives us a list of dictionary keys in the list of its values respectively. 45 00:03:52,030 --> 00:03:57,600 Now to get both the keys and the values, we can then use the items dictionary method to return the 46 00:03:57,600 --> 00:04:02,340 dictionary items object, which makes the key value pairs in two tuples. 47 00:04:02,640 --> 00:04:04,880 We can then parse the stupid to list. 48 00:04:04,890 --> 00:04:18,390 For example, if we say spam is equal to C gets cold and then C all three, C minus colon three, then 49 00:04:18,390 --> 00:04:19,510 we see list. 50 00:04:19,980 --> 00:04:22,530 OK, sorry I made some mistake. 51 00:04:23,920 --> 00:04:24,700 Netas. 52 00:04:26,090 --> 00:04:34,190 Cooperate on it three, and then we see a list in the bracket spam dot. 53 00:04:38,600 --> 00:04:39,260 Items. 54 00:04:41,230 --> 00:04:47,430 We get your cat, dogs, mice, so we're calling item the list, we can vote this from dictionary key 55 00:04:47,430 --> 00:04:49,470 value pair into a list of Dupas. 56 00:04:49,860 --> 00:04:55,590 This is exactly what we need to do with the frequency to let Alicja dictionary so we can sort the little 57 00:04:55,620 --> 00:04:58,180 strings and the normal order of frequency. 58 00:04:58,380 --> 00:05:05,890 So now we come to converting the dictionary items to sortable list the frequency to letter dictionary, 59 00:05:05,890 --> 00:05:12,660 a dictionary which has integer frequency columns as its keys and the list of single letter strings as 60 00:05:12,660 --> 00:05:13,400 its values. 61 00:05:13,680 --> 00:05:18,910 So to solve the string in the frequency order, we call the items matter and the list function to create 62 00:05:18,910 --> 00:05:22,310 a list of pupils to the dictionaries key value. 63 00:05:22,340 --> 00:05:27,180 But then we store this list of pupils in a variable named frequency. 64 00:05:27,840 --> 00:05:34,440 So if we go back to our program over here and you can check out here, we are having frequency here, 65 00:05:34,530 --> 00:05:38,730 which is equal to list in frequency two, letter to standard items. 66 00:05:38,820 --> 00:05:46,380 And then we are having frequency or better still, not sold by and the value. 67 00:05:46,440 --> 00:05:52,790 But now we come to the fourth part that is converting the dictionary items to us or whatever list. 68 00:05:53,310 --> 00:06:00,660 So the frequency to like Oresteia Dictionary has an integer frequency count, has its keys and list 69 00:06:00,660 --> 00:06:03,720 of single letters string as its values. 70 00:06:04,020 --> 00:06:10,440 So to sort the strings in the frequency, although we then call the items method and the list function 71 00:06:10,440 --> 00:06:13,950 to create a list of tuples of the dictionaries key value. 72 00:06:13,950 --> 00:06:18,660 But then we store this list of people in the variable named frequency. 73 00:06:19,380 --> 00:06:22,950 So here we are having the frequency pairs created. 74 00:06:23,670 --> 00:06:32,250 Then we pass the get item at index zero function over here in the sort that particular value that we 75 00:06:32,250 --> 00:06:35,150 define earlier in the program to the third method. 76 00:06:35,150 --> 00:06:35,910 That and. 77 00:06:37,230 --> 00:06:44,500 So they get item index function, gets the first item in the Tupa, which in this case is the frequency 78 00:06:44,500 --> 00:06:45,420 count in BIJA. 79 00:06:45,720 --> 00:06:52,030 This means that the items in the frequency bed are sorted by the numerical order of the frequency count 80 00:06:52,050 --> 00:06:52,740 integers. 81 00:06:53,160 --> 00:06:59,790 Then also we pass through for the reverse arguments for the tubas are revulsed order from the largest 82 00:06:59,790 --> 00:07:01,590 frequency count to the smallest.