00:01
Hello, welcome to this lesson.
00:02
In this lesson, we've been given a list that is from 1 to that has integers from 1 to 1000 and you're expecting the pair.
00:12
So the pair would be a, b, a times b would be close to 2, 4, 2, 4.
00:28
Okay, but here a and b would have to be in the range 1 to 1000.
00:40
Okay, so both a and b should be in a list.
00:44
Alright, so let's go on.
00:46
The first thing that we'll do is that let's have the list.
00:52
Okay, this list will contain values from 1 to 1000.
00:59
So i'll do x for x in range and i'll provide the range from 1 to 1001 because this one inclusive.
01:12
The one is inclusive.
01:16
The 100, 1001 is not inclusive.
01:21
Okay, so it'll go all the way to 1001 minus 1.
01:26
And now let me have a dictionary that will store key value pairs.
01:33
So the key would be, so for example, the key would be a and the value would be b.
01:40
So each time i'm actually doing, i'm inserting the key value, i'm going to check whether i already have that in there.
01:51
Okay, so that i don't insert ones that are already in because we are looking at pairs that are unique.
01:59
Okay, so let me create this dictionary.
02:03
So you're using python for this, but it's dictionary in python.
02:10
I'm going to say for i in the list that we have, i'm going to check if so that i goes from 1 to 1000.
02:24
So at each one, i'm going to divide the i by the 2, 4, 2, 4.
02:31
And if i divide in there's no remainder, then i'm going to say it is one of the factors and i'm going to the answer that it gives actually gives the, so if i divide a by 2, 4, 2, 4, and a is a factor, it will surely give an answer on your study to b.
02:54
But you're going to use mode.
02:56
Then if i see it has no remainder, that is apart from zero, i would actually do an integer division to get the one.
03:08
Let's go say if 2, 0, 2, 4, 2, 4, mode i is equals to zero.
03:26
It's equals to zero means that i can actually divide 2, 4, 2, 4 without remainder.
03:35
So i'm going to say key is equals to, i will now divide 2, 4, 2, 4 by i.
03:49
Okay.
03:50
Then i'll put the results into the ls dict.
03:56
But before then, let me check if the results is not ready.
03:59
So i'm going to say if key, okay, not in ls dict, i'm going to say ls dict, but update.
04:19
Then i'll put in the key.
04:22
I'll put in the key together with its value.
04:28
Its value is the i.
04:29
Because both the key and the i gives, if you multiply the i by the key, it gives the, so they are both factors...