1 00:00:00,500 --> 00:00:04,610 In this video, we are discussing different looping techniques in Python. 2 00:00:05,850 --> 00:00:08,940 So Loop's in PyCon with condition at the top. 3 00:00:09,390 --> 00:00:13,920 So here you see in this particular fracture, the condition is at the top and then we're having the 4 00:00:13,920 --> 00:00:18,710 body of the loop here after this condition, which will be at the top of the loop. 5 00:00:19,320 --> 00:00:25,350 So this can be implemented using normal while loop without Brigstock means the condition of the while 6 00:00:25,350 --> 00:00:29,880 loop will be at the top and the loop dominance when the condition is getting false. 7 00:00:30,210 --> 00:00:35,850 So this expansion of the loop, when the condition is true, then the body of the loop will get executed. 8 00:00:36,120 --> 00:00:39,060 When the condition is false, then it will come out from this loop. 9 00:00:39,060 --> 00:00:40,020 That is the exit loop. 10 00:00:40,230 --> 00:00:44,970 So here to see the placement of the condition is at the top of the body. 11 00:00:46,360 --> 00:00:52,060 Lupin Bitan with condition in the middle, just look at look at here, this is our condition, which 12 00:00:52,060 --> 00:00:54,940 is at the middle, and here we're having the body of the loop. 13 00:00:54,950 --> 00:00:58,060 Prior to that, we're having the body of the loop after that. 14 00:00:58,450 --> 00:01:00,820 But when is he in the entering into the loop? 15 00:01:01,060 --> 00:01:04,380 The body at this for the first time will get executed. 16 00:01:04,690 --> 00:01:06,010 Then the condition will be checked. 17 00:01:06,340 --> 00:01:09,550 If it is brickies there, if there is some break, then it will come out. 18 00:01:09,940 --> 00:01:13,260 And if there is no break, then it will continue with the loop. 19 00:01:13,510 --> 00:01:17,350 And then again, the control will come on, come here. 20 00:01:17,470 --> 00:01:19,740 And in this way the loop will get executed. 21 00:01:19,960 --> 00:01:23,380 There is a loop in the python condition in the middle. 22 00:01:25,620 --> 00:01:30,730 Lupin Biton with the condition at the bottom here to see we're having this condition at the bottom. 23 00:01:31,050 --> 00:01:38,670 So this kind of loop ensures that the body of the loop is executed at least once and it can be implemented 24 00:01:38,670 --> 00:01:43,170 using infinite loop along with the condition of the at the end. 25 00:01:43,830 --> 00:01:51,320 This is similar to do while loop in C, but in Python we do not have the do while loop. 26 00:01:51,600 --> 00:01:56,000 So that's why it can be simulated in Python in this hospitably. 27 00:01:56,340 --> 00:01:57,750 So control will come along here. 28 00:01:58,170 --> 00:02:00,200 The loop body of the loop is there. 29 00:02:00,420 --> 00:02:02,610 If the break is there then it'll come out. 30 00:02:02,610 --> 00:02:06,210 That is exit loop other as the condition will be continued. 31 00:02:08,840 --> 00:02:16,280 Infinite loop in Python, so we can create an infinite loop using wild stickman if the condition of 32 00:02:16,280 --> 00:02:18,510 the loop while loop is always true. 33 00:02:18,740 --> 00:02:20,480 We get an infinite loop. 34 00:02:21,170 --> 00:02:27,090 So while true, just I'm showing you that how to write and one infinite looping while true. 35 00:02:27,110 --> 00:02:28,200 So just see it. 36 00:02:28,430 --> 00:02:30,170 This will remain true for ever. 37 00:02:30,170 --> 00:02:33,760 So it will go on executing because the condition is not going to get false. 38 00:02:34,250 --> 00:02:41,360 So anything that I do and the input input an integer so and prompting user to the input function that 39 00:02:41,360 --> 00:02:45,920 please enter some value from the keyboard as input but input returns string. 40 00:02:45,930 --> 00:02:49,470 So I'm doing the typecasting here and converting it to integer. 41 00:02:49,970 --> 00:02:57,800 So if in percentage two is the goal is to print even numbered as odd numbered and you see that indentation 42 00:02:57,800 --> 00:03:02,040 is there, that means all these statements are under the while construct. 43 00:03:02,210 --> 00:03:07,730 So what will happen if you go on executing, on executing and it will be asking values from the keyboard 44 00:03:07,730 --> 00:03:13,570 as input and it will just tell her that the number, whatever you are provided, is even or odd. 45 00:03:13,790 --> 00:03:18,020 So this is a good example of this infinite looping in Python. 46 00:03:18,410 --> 00:03:23,600 So in this article, we have discussed the different looping techniques that is putting the condition 47 00:03:23,600 --> 00:03:28,490 at the top, putting the condition in the middle, putting the condition in the bottom, how to write 48 00:03:28,490 --> 00:03:29,920 this infinite looping. 49 00:03:29,960 --> 00:03:31,700 We have discussed that one in the details. 50 00:03:32,090 --> 00:03:33,350 Thanks for watching this video.