In this video, we are discussing different looping techniques in Python.
So Loop's in PyCon with condition at the top.
So here you see in this particular fracture, the condition is at the top and then we're having the
body of the loop here after this condition, which will be at the top of the loop.
So this can be implemented using normal while loop without Brigstock means the condition of the while
loop will be at the top and the loop dominance when the condition is getting false.
So this expansion of the loop, when the condition is true, then the body of the loop will get executed.
When the condition is false, then it will come out from this loop.
That is the exit loop.
So here to see the placement of the condition is at the top of the body.
Lupin Bitan with condition in the middle, just look at look at here, this is our condition, which
is at the middle, and here we're having the body of the loop.
Prior to that, we're having the body of the loop after that.
But when is he in the entering into the loop?
The body at this for the first time will get executed.
Then the condition will be checked.
If it is brickies there, if there is some break, then it will come out.
And if there is no break, then it will continue with the loop.
And then again, the control will come on, come here.
And in this way the loop will get executed.
There is a loop in the python condition in the middle.
Lupin Biton with the condition at the bottom here to see we're having this condition at the bottom.
So this kind of loop ensures that the body of the loop is executed at least once and it can be implemented
using infinite loop along with the condition of the at the end.
This is similar to do while loop in C, but in Python we do not have the do while loop.
So that's why it can be simulated in Python in this hospitably.
So control will come along here.
The loop body of the loop is there.
If the break is there then it'll come out.
That is exit loop other as the condition will be continued.
Infinite loop in Python, so we can create an infinite loop using wild stickman if the condition of
the loop while loop is always true.
We get an infinite loop.
So while true, just I'm showing you that how to write and one infinite looping while true.
So just see it.
This will remain true for ever.
So it will go on executing because the condition is not going to get false.
So anything that I do and the input input an integer so and prompting user to the input function that
please enter some value from the keyboard as input but input returns string.
So I'm doing the typecasting here and converting it to integer.
So if in percentage two is the goal is to print even numbered as odd numbered and you see that indentation
is there, that means all these statements are under the while construct.
So what will happen if you go on executing, on executing and it will be asking values from the keyboard
as input and it will just tell her that the number, whatever you are provided, is even or odd.
So this is a good example of this infinite looping in Python.
So in this article, we have discussed the different looping techniques that is putting the condition
at the top, putting the condition in the middle, putting the condition in the bottom, how to write
this infinite looping.
We have discussed that one in the details.
Thanks for watching this video.