WEBVTT

00:01.280 --> 00:02.280
Hello, everyone.

00:02.570 --> 00:09.680
In this particular session, we would be discussing about follow up on Vinu, so first we need to know

00:09.680 --> 00:13.420
what is actual need of these moves and what are loop's.

00:13.940 --> 00:20.870
So here I have a piece of code where I have created a list of names.

00:21.200 --> 00:25.100
So I have address John Tokyo and Berlin.

00:26.240 --> 00:35.020
Now let's say you want to display the names one by one and we want to say hello, hello.

00:36.070 --> 00:37.370
Hello, hello, Tokyo.

00:37.820 --> 00:40.520
So let's just run this.

00:41.770 --> 00:51.100
So here, if you see the outrage over this entire list and we are taking one index of the list at a

00:51.100 --> 00:59.920
time and then trending this now while doing this entire thing, first of all, I had to type all the

00:59.920 --> 01:02.680
lines of code again and again.

01:03.740 --> 01:08.430
And I have just five lines of code, which I had to write here.

01:08.690 --> 01:16.850
So it was a little simple for me, but let's say instead of these five means, we have five hundred

01:16.850 --> 01:17.320
names.

01:17.630 --> 01:25.160
So in that case, would it be feasible for me to type in Palo and then names again and again?

01:25.160 --> 01:26.240
Five hundred names?

01:26.510 --> 01:26.760
No.

01:26.780 --> 01:27.060
Right.

01:27.200 --> 01:29.160
It would be pretty difficult for us.

01:29.510 --> 01:33.730
So this is where we need four or you.

01:34.990 --> 01:43.840
What this actually helps us in, so here we are able to iterate over a particular object, so that could

01:43.840 --> 01:44.990
be a list.

01:45.520 --> 01:47.110
It could be a string.

01:47.260 --> 01:48.640
It could be range.

01:49.920 --> 01:51.910
I'm and I read on top of it.

01:53.460 --> 02:03.570
And we can use one item out of the entire sequence, one by one on this play or whatever action we want

02:03.570 --> 02:03.900
to do.

02:04.140 --> 02:08.340
So here what we can do is we can trade over the sequence means.

02:08.580 --> 02:15.170
So when we will agree to work, we will get the name Horia first, then we can print it.

02:15.360 --> 02:20.620
Then the next value would be SANZAR, so we can trade on top of it.

02:20.820 --> 02:23.260
So let us see, what is this index for that.

02:23.910 --> 02:27.390
So this index for Falu would be for.

02:28.400 --> 02:29.720
Then we write.

02:33.050 --> 02:34.940
Obviously, you've seen me.

02:36.120 --> 02:42.810
In names, this is the list which I want to I try to wear so I would see names.

02:44.160 --> 02:45.510
Then I give the Colin.

02:46.700 --> 02:56.120
I hit enter and the automatic indentation comes in, so again, just like if as we need to provide information

02:56.120 --> 03:00.600
in for loop also, so we will provide this indentation.

03:00.890 --> 03:04.790
Now, this name is just a very boobage I have created.

03:04.970 --> 03:06.650
I can give it any value.

03:06.650 --> 03:14.410
I can give it IGP or any other name or some name, any kind of variable could be created.

03:14.420 --> 03:18.230
This does not this is just a dummy name so we can give it anything.

03:18.240 --> 03:20.690
So I will use name now.

03:20.720 --> 03:22.670
I will just say print.

03:24.480 --> 03:25.140
And.

03:26.150 --> 03:28.640
I will say hello.

03:29.600 --> 03:30.560
Space.

03:31.500 --> 03:33.120
And I would say name.

03:35.850 --> 03:36.510
And.

03:38.500 --> 03:46.090
One said on this, I get the entire thing again, so instead of writing the lines again and again,

03:46.090 --> 03:50.360
I can do the same thing by just writing a single line of code.

03:50.920 --> 03:53.600
So this is what Falu provides us.

03:54.070 --> 03:56.990
So let us see, what do we have here?

03:57.490 --> 04:04.780
So the for loop, I agree to a sequence of items and runs a statement for each item.

04:05.620 --> 04:12.230
Once the items are exhausted, it stops the loop and runs the next line of code.

04:12.580 --> 04:14.200
So it would stop it.

04:14.200 --> 04:19.000
Would it read over an entire sequence and pick out the items it will best?

04:19.180 --> 04:20.470
That is the sequence.

04:20.480 --> 04:27.730
And so if the sequence is not and B we still have some items, then it will run the statement book and

04:27.730 --> 04:32.290
then go back to the for loop and figure out the next element in the sequence.

04:32.530 --> 04:40.810
It will decide if the sequence is empty, then it will get out of it, otherwise it will keep iterating.

04:40.810 --> 04:41.620
I'm doing this.

04:41.620 --> 04:44.740
We exhaust all the elements which are present in the sequence.

04:45.520 --> 04:49.850
This is how for Loop works and we have seen the syntax for it.

04:50.140 --> 04:53.920
Now let us see what type of values of all look inside.

04:54.730 --> 04:57.310
So first we will look for a string.

04:58.610 --> 05:01.820
So it does have a spring save for.

05:04.260 --> 05:07.050
I do or see.

05:08.730 --> 05:09.330
Gary.

05:10.640 --> 05:14.570
And let's give any string my.

05:15.760 --> 05:18.250
My name is.

05:19.630 --> 05:20.380
John.

05:21.870 --> 05:25.230
OK, this is the string which I have and.

05:26.130 --> 05:28.280
I would simply say the same thing.

05:32.770 --> 05:33.520
Brent.

05:35.980 --> 05:36.520
Gary.

05:38.010 --> 05:47.820
Plus, let's see anything, let's say one, two, three, OK, so we can run this and it will just stay

05:48.120 --> 05:52.890
and display whatever we wanted related to what each and every character of the string.

05:53.930 --> 06:00.650
Why is it trading on each and every character of the string, as you already know, a string is a sequence

06:00.650 --> 06:01.760
of characters.

06:02.030 --> 06:05.640
That is the reason why it was able to I on top of these.

06:06.130 --> 06:10.820
Now, I can give any number of code of lines here.

06:11.150 --> 06:16.880
I can see friend one plus.

06:17.870 --> 06:24.140
To then it will again do this, I can have another look inside this.

06:25.840 --> 06:27.010
For, let's say.

06:28.550 --> 06:30.530
I am.

06:33.230 --> 06:38.130
Hi, and then we save print.

06:38.780 --> 06:45.620
So if you can see we are nesting the for loop again, so we'll just rent I, I.

06:47.240 --> 06:48.090
Let's see.

06:49.070 --> 06:55.790
So it is printing the character first, the character plus one, two, three.

06:56.150 --> 07:03.140
Then it is printing this three which we have made a before and after that does it reading on top of

07:03.140 --> 07:04.600
the characters in high.

07:04.910 --> 07:06.890
So it does printing etch and then.

07:07.910 --> 07:12.130
So this is how we can it on top of characters of a string.

07:12.530 --> 07:17.610
Now we have already seen how we can iterate on top of elements in the list.

07:17.990 --> 07:22.550
Now let us see how we can I trade on numbers on predefined numbers.

07:22.880 --> 07:24.260
So let us see.

07:25.280 --> 07:28.250
First of all, let me introduce range to you.

07:29.620 --> 07:30.790
So for.

07:33.160 --> 07:36.940
Well, in range.

07:41.530 --> 07:48.470
So I'm running this on range then, and I will simply print the world for you.

07:49.210 --> 07:50.650
So here you see.

07:52.320 --> 08:01.680
The value is being printed, so it is trading on numbers from zero to nine.

08:02.100 --> 08:07.690
So if we give range then so it will go from zero and the split in values.

08:08.040 --> 08:09.150
Now, let us see.

08:09.160 --> 08:13.530
We want to start from let's say.

08:15.390 --> 08:17.940
Twenty and more than.

08:20.930 --> 08:21.920
Twenty five.

08:23.530 --> 08:25.750
Then here it is.

08:26.220 --> 08:33.330
Now, let us say we want to skip a few numbers in between so we can give the step function also here

08:33.340 --> 08:37.210
to simply walk like the slicing, which we have.

08:37.540 --> 08:39.400
So it is simply like slicing.

08:39.790 --> 08:44.940
We give the starting point, then we give the last value minus plus one.

08:45.250 --> 08:46.850
And this is a step function.

08:47.560 --> 08:49.510
This is this.

08:49.510 --> 08:55.960
Now that is one more thing which we need to include, which is including continue.

08:56.140 --> 08:58.570
So let us see how we can continue.

08:58.840 --> 09:02.200
So let us say we are working on.

09:03.520 --> 09:04.320
This particular.

09:05.680 --> 09:15.250
This particular look, now let's do one thing, the letters include a new value here as count.

09:16.640 --> 09:17.450
And.

09:18.620 --> 09:22.580
We made this count as zero and after each law.

09:24.100 --> 09:33.580
We will change the value of pound is equal to pound plus one, so we are increasing the value of pound

09:33.580 --> 09:35.500
after each iteration.

09:36.040 --> 09:38.860
So let us do one thing now after this.

09:41.630 --> 09:44.180
Let us bring county instead of this.

09:45.600 --> 09:51.420
OK, now let's check a condition for an itch, so.

10:03.440 --> 10:09.260
Sound is greater than, say, six.

10:14.780 --> 10:17.270
Then we are doing all.

10:19.650 --> 10:20.330
Continue.

10:23.310 --> 10:31.290
Now, what continue does is that whenever we encounter a condition, whenever we encounter continue,

10:31.830 --> 10:42.510
then it will not run these lines of food and it will simply go back and.

10:43.910 --> 10:46.400
Continue with the vibrations.

10:47.700 --> 10:50.850
Let me do one thing, let me please the council before.

10:51.940 --> 10:52.570
Continue.

11:00.200 --> 11:01.880
So let us run this.

11:04.760 --> 11:08.350
So here what happened is it is trading on the perfect.

11:09.340 --> 11:10.090
So.

11:11.410 --> 11:14.260
It has not increased the volume.

11:17.180 --> 11:21.020
Now, let me put it above that if condition.

11:26.830 --> 11:30.070
And let us keep it till three for convenience.

11:32.720 --> 11:41.880
So it is printing and then it is having volume zero down, volumes one, this is two, this is three.

11:42.200 --> 11:44.630
So when the pound value is three.

11:46.240 --> 11:54.150
This is here, the ground value becomes three, so it will check that its value is greater than three,

11:54.580 --> 11:56.030
then it will continue.

11:56.290 --> 11:58.930
So it is not printing high after this.

12:00.730 --> 12:06.580
Now, let's say they don't want to bring these values, also, we just want to break the loop and come

12:06.580 --> 12:10.180
out of it once the value of golf is greater than three.

12:10.390 --> 12:16.660
So instead of writing continue, we can simply write, break and dig the new.

12:17.620 --> 12:22.030
So here it has written for us.

12:26.270 --> 12:35.180
Now, let us discuss about why you saw the difference between four and why was that in case of violence?

12:35.330 --> 12:43.760
We are tripping on top of an entire sequence, but in case of violence, we see why and devalue the

12:43.760 --> 12:44.920
particular conditions.

12:44.960 --> 12:49.690
The account is less than five.

12:51.200 --> 12:55.010
Then he wanted to do something, then we wanted to.

12:55.990 --> 12:56.700
Brent.

12:58.320 --> 12:59.670
The value of count.

13:00.830 --> 13:05.240
And after opening day, we wanted to update the value of ground.

13:11.650 --> 13:15.980
Let me we sure initialize the value of found.

13:18.610 --> 13:20.730
So here.

13:21.720 --> 13:29.390
We are running this, so it will start with ground value as it evaluates the value of so here the value

13:29.400 --> 13:30.780
found is less than five.

13:31.110 --> 13:36.990
It brings the value of ground and updates the value of found to and then again, it goes back.

13:36.990 --> 13:44.310
It checks that the value of gold is less than five and it keeps doing that until the account value is

13:44.310 --> 13:45.240
equal to five.

13:45.660 --> 13:47.940
So this is what value looks like.

13:48.300 --> 13:50.200
The index is just the same.

13:50.580 --> 13:52.100
So we see why.

13:52.410 --> 13:58.250
Then we give the condition and then we give the colon and we give the indentation.

13:58.680 --> 14:04.620
Similarly for for loop the give for the give the items on which we want to intrude upon.

14:04.980 --> 14:13.590
We give the sequence, then we give the sequence details that it is a range or if it is a particular

14:13.590 --> 14:18.360
list of characters or if it is a list, it says.

14:19.680 --> 14:29.400
So this is how life works now, apart from this vital condition, we can also have white ants in other

14:29.400 --> 14:30.050
languages.

14:30.060 --> 14:34.110
We do not have the option of else, but could increase survival.

14:34.140 --> 14:35.820
We also have violence.

14:36.210 --> 14:38.010
So let us look at the.

14:40.490 --> 14:49.700
So for Vilo, it repeatedly executed a bluff of food indefinitely a number of times and until the human

14:49.700 --> 14:51.110
condition becomes false.

14:51.290 --> 14:55.550
So here we were checking the condition that this count is less than five.

14:55.550 --> 14:59.390
And once the condition becomes false, it comes out of the way.

14:59.400 --> 15:06.730
You now, invitingly, can add an optional clause after the end of the view.

15:07.070 --> 15:12.830
So we can add as fills the code inside the as clause would always run.

15:12.840 --> 15:23.000
But after the you finish execution, the one situation when it will not run is if the loop exits after

15:23.000 --> 15:23.470
a break.

15:23.480 --> 15:24.200
Stay tuned.

15:24.770 --> 15:29.740
So let us go back to let us add is the mission.

15:30.440 --> 15:34.480
So is why golf is less than five.

15:35.240 --> 15:42.020
It will bring this, it will update the calendar and then the goal is not less than fine.

15:42.530 --> 15:43.580
It will print.

15:53.610 --> 15:54.930
The very influential.

15:58.560 --> 16:08.970
So this so it initially ran the ground, it didn't run from zero before that, and after that it will

16:08.970 --> 16:09.990
run the S.T..

16:12.160 --> 16:15.260
Let us make the value of count is equal to five.

16:15.280 --> 16:22.660
So in this situation, the count will be equal to five, so the condition will not satisfy and this

16:22.660 --> 16:24.250
will never become to equal that.

16:24.260 --> 16:25.210
It'd be false.

16:25.690 --> 16:27.540
So let us try this one.

16:27.790 --> 16:29.990
So here the number is greater than five.

16:30.010 --> 16:31.960
The value runs.

16:32.230 --> 16:34.140
It is a false condition.

16:34.150 --> 16:38.020
So it does not run this be supported by Tehran and its condition.

16:38.710 --> 16:41.470
So this is what VIU is.
