By Tony Traditions using for.
So the for loops indexing Biton the for Lupin Python is used to edit it over a sequence and sequence,
maybe at least maybe a double, maybe a string or any other iterable objects.
So iterating over the sequence is also known as a diverse.
That was for each and every looping it pick up one element from the editor and that element can be processed.
So here is a despicable syntax for four.
So for Val in sequence.
Don't forget to give this colon here.
And if you get this colon, then automatically the next line will have some indented.
So body of thought.
You can have the multiple statements.
You can write.
But with the same indentation in that case.
So here is a flowchart.
So for each item in sequence.
Last item list.
If we just know the body of four will get executed on that item, which has been picked up in the last
item has been missed.
Then it will exit loop.
So in this way, the respective flowchart will be working on this for loop syntax in by time.
We can also do this one using that range function so we can generate a sequence of numbers using range
functions.
So far, Loop can be operating on a certain sequence.
That is, the editable objects are also using this range function to range.
Then will generate numbers from G2 to nine.
So that is the ten numbers we are having here.
So always remember here, this 10 will not be inclusive.
So zero to nine.
That is a ten numbers we are having.
So we can also define the start, stop and step side as range.
This is a start.
Comma.
Stop.
Comma.
Step side.
So SIST Estep site defrauds is one.
If it does not provide it, let us know if we like this one has range.
One comma ten comma one.
That means it'll, it'll have the values ranging from one to nine.
And with the increment of one in that gets for loop with the else section.
So ForFour Loop can also have an optional.
Else block the eighth spot is executed.
When the items in the sequence used in for loop exhausts.
So in that when the when the sequence will get exhausted then the else part will get over the control.
So break stickman can be used to stop a for loop.
In such case the ill spot will be ignored.
On the other end.
So here's a for loops ILS part runs.
If no break occurs.
So if there is a break.
Then the L spot will not be executed.
Others it's partly because the Goodhead Lindale spot will be excluded.
When the sequence will get exhausted.
So let us go for some practical demonstration to show you that how this fault can be used in Python
code.
Let us find that.
How far Loop can work in Python?
So here to define what list.
We know that list elements are to be separated by commas and they are to be enclose within this card
brackets.
So this is our list here.
So printing all elements present in a set.
Had had this particular set is lacking.
But at least so far, I in a print I.
That this in each in a precondition in each and every loop.
This particular for using this for we are picking up one element from that list at a time and the respective
element is going to get better.
So here is the outcome for this code.
So the first iteration, it is picking up one, two and three at that address.
It is picking a fight so that this all guest list members are to be picked up to be to be read from
the list and the order in which they are appearing in the list.
So take this over forward.
So far I in.
So this is a syntax.
Syntax means that grammar.
Right this far.
So for I in a column.
So indicate that next step may be under this body.
So you can't find that if we write here.
Print.
Say hello.
That is also coming.
We didn't this far, so we can find that it is printing like this.
So I want to bring this one in.
Hello, Side-By-Side.
So we can go for this.
It is legal to now.
You can write this one and then you can print this.
Hello.
So what will happen?
This one and Unhallowed will get printed in the Cymbeline.
So you can in this way, you can write so many different statements with this indentation to indicate
that all the statements are within the four block.
Let's go for the next one here to using forward.
But using this range, we know that here too are given the range that is six comma element.
That was a value up.
I would be ranging from six to 10.
So let's go for the execution.
You see, the eye is being initialized with six to 10 for each and every time iteration.
After that, you also you can put some step Peluso here.
This table is two.
That means the increment value is two here.
So now we do go on picking up six, eight and 10 because Aylwin is not inclusive.
And that's why it will print the values from six to 10.
And with this increment factor of two in this way, you can write this for and using this range function
in our four.
So let us go forward and adapt another way.
So how to write this one?
You can find that using for love, for printing the values present in the couple and using the elf.
Come on in the follow up.
So how do you do that when you confront sic?
So this outcome we're having so Beezy, go to eleven, twelve, thirteen, fourteen and fifteen.
So they are coming in.
And this is nothing but a double for I in B C to be picking up the Velas from this double one value
at the time in each and every condition.
And when this particular couple we get exhausted then else Blokland get the control and then printing
completed.
That message is good.
Went to get printed.
So there is another way to write the for loop in our python coding.
So in this demonstration we have shown you that how to write fault in our python code to have some block
to get executed repeatedly for multiple number of times.
Thanks for watching this video.