Let's solve the next item.
So the problem here is greater function for food that determines if barometer number is a perfect number.
So it needs a number which needs to be provided.
And this function should tell us if the number is specific number.
Now, what is a positive number?
A ballpark number is if it is factors, including one, but not the number itself.
Some Stoody number itself.
So, for example, we have number six.
So the factors of six would be one, two and three.
And when we add one, two and three, it gives six as a result.
So it is a perfect number.
So we need to find a particular number if it is perfect or not.
Right.
So try this at your end.
Please note the conditions which are given.
So we need to run this for a range of numbers between one and thousand and return whatever number is
perfect.
OK.
So you can possibly do.
And I told them this question and you can look at the solution in case you want.
So you can post a video now.
OK, so let's solve the solution, Smiths solve this problem now.
So we will not create the function first, we will try to solve.
Find the logic first, and then we will convert this logic into a solution, into dual function.
So let's create a sum.
So let's first of all, we need to find out the numbers or let's consider a number, let's say in.
And this end is equal to six.
OK.
Now let's create some.
And assign this on as zero.
Now for number in the range, whatever we are providing for, let's say, four numbers for whatever
number there to number six, we are trying to solve this.
So if in.
Let's see divisible by any numbers.
So let's try it four of my double numbers or for I in range.
So the number factor can not be something which is zero.
So the fact that has to be greater than zero.
So we are seeing for a number from one to, let's say, number in total, that particular in for any
number.
We are checking the number itself.
So we are checking from one to the number two.
And because we will not consider six as the factors, we can go up in the range in and we need to check
if the number is completely divisible by this factor or not.
So we are saying if
I is equal to zero, then let's simply put it this way.
OK.
So let's do this for now.
So we are saying.
So what it does is it checks for all the numbers from one to end.
And whatever number is completely divisible by this number.
So basically, all the factors it is giving out as a result.
So it is printing all the factors.
So let's say in sort of six, we had two forty eight.
Then it will give Wollard all of its factors.
If we had, let's say, seventy six, it will give all of its factors.
So it goes like that.
So this is what we are doing now.
After this, we are seeing.
So it is doing this one particular number.
And then we are saying if the sum
is equal to the number itself.
OK.
So it is checking for the entire range for this number.
And so once it does it, it will.
And the numbers would need to sum the numbers also.
So we are seeing some physical do some plus
I instead of some, let's call it.
Yes.
So that it does not override the actual stomach function.
So we'll see.
Here.
And if it is equal to N, then we us we will return to.
If not, then, yes, we will.
The don
was not the source for a particular number.
Now we want to do this for a large list of numbers.
We want to do it for multiple numbers.
Right.
So this will be done for a particular number.
Now, I want to do this for multiple numbers, so I need to create a function for it.
So how do I convert this into a function for converting this into a function?
I can simply do what this perfect.
And it will take and as an input and it will do all these steps for us.
You can see I simply did a single tab which shifted all the line of code by one tab.
So I don't need to keep pressing tab.
Every time we want to move line, I can simply select everything and just do a single tab, push up
everything.
Now, once I'm done with this, I can run this piece of code.
So let's say I want to run this for a large number.
I want to run this for, let's say, 50 numbers, a thousand numbers.
I can simply say for an in range.
Thousand.
Now, I don't want to run it for zero.
So I can simply say start from one.
And I want to consider a thousand here because I want to rantel thousand.
So I need to give one thousand one, because then only it will run from one to one thousand.
If I give one no extra, I don't need to do it.
And after that, I want to run this function again and again.
So I will see if I will run this function.
I say I'll run both fake and inside this I will pass.
And so it will run this.
And every time this returns true because I have set fatal condition that it should return.
True.
If the number is perfect, that is, if the storm is equal to the number itself, then it will return
it.
So if it is returning true, then this is a condition itself.
So I can simply say here.
Well, if they thing, then it should bring
into me.
Or I can give
I can simply give I also here, I can run it anyway.
It is completely up to you.
So you can see from one to 1000, 628 and four ninety six had the numbers, which are think in nature.
We have made slight changes.
It was like this, but it needs to be like this because we need to let it run for a while.
We need to let it run for all the numbers from one to the number itself.
And once these factors have been gone through and the sun miscalculated completely, then only the sun
needs to be checked.