1 00:00:00,300 --> 00:00:05,290 Now, coming to running the program in silent mode or printing information to the user. 2 00:00:05,580 --> 00:00:12,150 Now, at this point, overkill, if you look at it in this, we have completed this up in part. 3 00:00:12,480 --> 00:00:18,710 Now over here, we want to know which those are the top three candidates for each subgroup. 4 00:00:19,020 --> 00:00:25,410 So if the silent mode constant was set to force earlier in the program, it would bring the values in 5 00:00:25,410 --> 00:00:27,800 all frequencies close to the screen over here. 6 00:00:28,110 --> 00:00:33,860 And if the silent mode was set to truly code in the if statement block would be skipped in this case, 7 00:00:34,470 --> 00:00:40,500 now that we have now reduced the number of subpoenas to a small enough number that we can brute force 8 00:00:40,500 --> 00:00:41,190 all of them. 9 00:00:41,520 --> 00:00:49,890 Next, we will learn how to use the tools DOT product, which we're using it over here, and we will 10 00:00:49,890 --> 00:00:56,460 see how to use this function to generate every possible combination of brute force succumbing to finding 11 00:00:56,460 --> 00:00:58,980 the possible suspects or combinations of subjects. 12 00:00:59,280 --> 00:01:03,860 Now that we have the possible CEP's, we need to put them together to find the whole key. 13 00:01:04,260 --> 00:01:11,100 The problem is that even though we found letters for each suppy, the most likely letter might not actually 14 00:01:11,100 --> 00:01:11,940 be the right letter. 15 00:01:12,120 --> 00:01:16,920 Instead, the second most likely or the total most likely letter might be the right subject. 16 00:01:17,310 --> 00:01:22,100 So this means that we can't just combine the most likely letters for eats up into one. 17 00:01:22,650 --> 00:01:26,770 We need to try different combinations of likely letters to find the right. 18 00:01:27,360 --> 00:01:29,360 Hence we are using over here. 19 00:01:29,370 --> 00:01:36,190 If you look at it, the other tools dot product function to test every possible combination of these. 20 00:01:36,900 --> 00:01:38,130 So let us understand this. 21 00:01:38,130 --> 00:01:44,930 I the product function, it produces every possible combination of items in the list or list, like 22 00:01:44,940 --> 00:01:47,290 values such as a string or pupil. 23 00:01:47,610 --> 00:01:53,400 Such a combination of items that also called Cartesian product, which is where the function gets its 24 00:01:53,400 --> 00:01:59,460 name, the function returns and idato product object value, which can also be converted to a list by 25 00:01:59,460 --> 00:02:00,540 passing it to list. 26 00:02:01,080 --> 00:02:08,740 Now, if you want to see and just an example of this, we'll go back here and we will see import first, 27 00:02:09,090 --> 00:02:17,030 say, Eitel tools and then we see Eido does not use product here. 28 00:02:17,070 --> 00:02:22,290 We give simple, say AVC and we give here repeat is equal. 29 00:02:22,290 --> 00:02:36,240 Before and after this we see a list of societal tools DOT product in Blackett, ABC and repeat is equal 30 00:02:36,240 --> 00:02:40,790 to four months we press and don't close this bracket to. 31 00:02:41,100 --> 00:02:44,940 You can see we're getting a list of all the possible combinations. 32 00:02:45,600 --> 00:02:48,830 So passing ABC on an integer four for a repeat key. 33 00:02:48,840 --> 00:02:56,490 One argument returns an identical product object when converted to a list and has to pull off four values 34 00:02:56,490 --> 00:02:59,130 with every possible combination of A, B, C. 35 00:02:59,370 --> 00:03:05,670 So this result in a list that has a total of somewhere around eighty one tuples, you can also pass 36 00:03:05,670 --> 00:03:13,190 list values to the total product on some values similar to list such as range object returns from the 37 00:03:13,200 --> 00:03:13,960 range method. 38 00:03:14,400 --> 00:03:25,380 So for example, if we try out C seeing list in bracket item to start product here we give range eight 39 00:03:26,190 --> 00:03:30,000 and C repeat is equal to five. 40 00:03:30,810 --> 00:03:35,850 So in this case, we would get here all the values in the range of eight. 41 00:03:36,870 --> 00:03:41,160 We'll need to import items and then. 42 00:03:42,490 --> 00:03:50,620 Let's try to give this over here again, list items or product range eight and repeat is equal to five. 43 00:03:51,910 --> 00:03:57,040 We have just expanded it and this is how we are getting the list of values is are too many lines. 44 00:03:57,340 --> 00:04:03,010 Hence it is giving us a shot at how many lines of code executed. 45 00:04:04,120 --> 00:04:10,000 So then the range object within the range, it is possible to store product along with five for repeat 46 00:04:10,000 --> 00:04:10,890 particular argument. 47 00:04:10,900 --> 00:04:16,270 It generates a list that has pull of five values, individuals ranging from zero to seven. 48 00:04:16,640 --> 00:04:22,240 Now we just passed an agricultural product, a list of potential safety because the function creates 49 00:04:22,240 --> 00:04:27,940 a combination of the same values and each of the subcu will probably have different potential letters. 50 00:04:28,270 --> 00:04:34,690 Instead, because our guys are stored in tuple in all frequency, schools will access those letters 51 00:04:34,690 --> 00:04:40,180 by the index values, which will range from zero to the number of letters we want to try minus one. 52 00:04:40,660 --> 00:04:46,450 We know that the number of letters in each tuple is equal to the number of frequency letters because 53 00:04:46,450 --> 00:04:51,020 we only store that number of potential letters in each tuple also. 54 00:04:51,250 --> 00:04:56,470 So the range of indexes we will need to access is from zero to number most frequency letters. 55 00:04:56,680 --> 00:05:03,670 So if we go back to our program here and we are giving it a range of NUM most frequency letters and 56 00:05:03,670 --> 00:05:04,570 we also pass. 57 00:05:04,570 --> 00:05:10,780 I talked to what products are likely Guyland as the second argument, creating tuples as long as the 58 00:05:10,780 --> 00:05:16,990 potential kilim, for example, if we wanted to try only the first three most likely letters of each 59 00:05:16,990 --> 00:05:24,550 subject, then Faruqi, that's likely five letters long the false evaluator to product to produce something 60 00:05:24,550 --> 00:05:31,210 like zero zero zero zero zero and the next would be say zero zero zero zero one. 61 00:05:31,540 --> 00:05:34,900 So until two comma two two two two two. 62 00:05:35,200 --> 00:05:42,400 So each integer and the five value tuple represents an index of all the frequency scores succumbing 63 00:05:42,400 --> 00:05:49,950 to accessing this up in all the frequency, the value in the all frequency score is a list that holds 64 00:05:49,960 --> 00:05:55,100 basically your most likely letters of each subject, along with the frequency Mitsuko's. 65 00:05:55,810 --> 00:05:58,510 So to see how that particular example works. 66 00:05:58,960 --> 00:06:04,120 Now, once you are able to access the potential up using all frequencies code, you need to combine 67 00:06:04,120 --> 00:06:05,830 them to find the potential letters. 68 00:06:06,140 --> 00:06:12,430 So now we come to creating this combination with the tools DOT products that will be produced by the 69 00:06:12,460 --> 00:06:14,970 identical product each represent one. 70 00:06:15,350 --> 00:06:21,520 The position in the tuple corresponds to the first index, the axis in all frequency scores and the 71 00:06:21,520 --> 00:06:24,580 integer into tuple represents the second index. 72 00:06:24,820 --> 00:06:30,910 We axis in the all frequency schools now because this said been the most frequency letter constant for 73 00:06:31,230 --> 00:06:37,390 the I got all the product on this particular line would cause the default to have a couple of individuals 74 00:06:37,390 --> 00:06:43,690 from zero to three, representing four most likely letters for each subgroup of the indexes variable.