WEBVTT 00:01.330 --> 00:06.580 If a loop exists inside the body of another loop it's called nested loop. 00:07.030 --> 00:15.130 Let's see an example of nested loop. 00:15.300 --> 00:24.160 You see I equal to 1 create a while loop IE is less than equal to 00:28.020 --> 00:31.000 every revolutionized. 00:31.010 --> 00:31.840 Another variable 00:34.900 --> 00:43.170 and then we started another loop seeing J is less than equal to 5. 00:43.280 --> 00:46.200 Here we are printing the values of 00:49.440 --> 00:53.950 i and j. 00:54.100 --> 00:54.580 Saying 01:05.860 --> 01:18.490 then will increase in the value of j by 1 slow this loop will execute 5 times and then we are saying 01:18.550 --> 01:22.660 increase the value of a by 1 01:25.320 --> 01:27.190 or save this program as 01:30.530 --> 01:31.220 nested loop 01:37.000 --> 01:38.580 let's execute the program. 01:41.220 --> 01:52.110 So observe that when the value of I was 1 the inner loop executed 5 times and the value of j changed 01:52.110 --> 02:03.760 from 1 to 5 after that the outer loop started second time and the value of ages 2 to and again the inner 02:03.780 --> 02:07.480 loop executed 5 times. 02:07.540 --> 02:15.760 This is how nested loop works in pattern let's do some changes in the program 02:22.410 --> 02:27.460 look here instead of i.e. less than equal to say less than equal 5. 02:27.520 --> 02:31.210 And here we see I sorry j is less than equal to 02:34.160 --> 02:42.120 here will bring the value of j and let's see what. 02:48.180 --> 02:56.640 So observed the output here the output is 1 One two one two three one two three four one two three four 02:56.640 --> 03:07.570 five So whenever the print statement executes it changes the line. 03:07.610 --> 03:09.890 Why do we don't want that. 03:09.920 --> 03:16.310 What if we want the output to be like one one two one two three one two three four and one two three 03:16.310 --> 03:16.810 four five 03:19.390 --> 03:30.690 So the print function comes with an optional barometer card and and the default value of this parameter 03:30.720 --> 03:35.800 is new line meaning after print changed the line. 03:36.620 --> 03:45.480 So here we are changing the value of end barometer to NUM and after print in one line 03:52.510 --> 03:53.940 go to the next line. 03:57.000 --> 04:07.110 Let's see the output Mark. 04:07.150 --> 04:13.710 This was a little variation with the print statement see you in the next lecture.