Hello, everybody.
Now, I can say surely that we are over all of the theory regarding why we have seen some basics and
we have been over the advanced all the topics that we have been through while loops are behind us now,
we have seen many examples in the previous lectures, and I think that we are ready now to start practicing.
All right.
So before we begin, I just want to give you a warning, a heads up, that this challenge of completing
these assignments would be a bit harder.
All right.
So we're getting closer to some high level topics, which are a bit more complicated and challenging.
But again, if you went over all of my lectures regarding python development, I'm sure that you can
overcome these assignments easily because there is no topics here that we haven't covered in previous
lectures.
All topics in these assignments appear in previous lectures of Python programming that are in this course.
All right.
So first of all, let's begin from Pardey.
All right.
So, first of all, please create the list of ages with these integers inside.
Then you should add up a condition to a wire loop while the condition should be that the ages should
be under 20, under 30.
All right.
And in this case, we have a list.
All right.
So in previous lectures, as we discussed, while loops, we always took a variable.
All right.
It was something like this.
I'm just going to talk regarding this this assignment right here.
So in previous lectures, we have created a variable number, for example, and then we had wild number.
This hour to correct massive capital, while no.
Is smaller than 30 and then blah, blah, blah, and then, hey, here, we had this sort of thing,
right?
So this was actually mean that on each cycle grow this number by one and this is how we handled a loop.
All right.
But in this case, we have something bit challenging.
We have a list here.
All right, we have a list and how we overcome this, because if I create the list right.
Haiti's out, correct, if I create a list.
All right, so I can't just put the list right here and do expect the Willink to scan each item on each
cycle.
All right.
Because it's just we throw out here the list without mentioning what you do with it.
So we need to do something with the cells.
Right.
We need to each cycle to scan the cells here.
And how do we do it?
You have a hint here, right?
The hint is create an additional variable, which is a counter, and then use this counter to scan the
items on each cell, each cycle.
All right.
And grow this counter by one on each cycle, OK?
If you haven't caught what I just said, just repeat it and use a counter here.
If I give you some more clues, are basically going to give you the answer.
Straightforward.
And I don't want to do it because it's going to ruin the whole point of this challenge of science.
All right.
So this is regarding this part right here.
OK, use a counter.
And that way you can use to use the counter to scan each cell in the list one by one.
All right.
So this is regarding this part.
All right.
Print each tested cell inside the inside the loop.
So each time we are is entering the cycle, print out the cell value that you're now testing.
Once the condition is false, print the cell that caused it.
All right.
Because eventually we're testing your ages and the condition of the wire loop should look for ages under
30.
So as long as it is under 30, it's OK.
But once we get to this bar, for example, so the the loop should fail because it's over 30.
OK, so please, outside the wire loop print the value that caused the wire to fail.
All right, I am OK.
And at the end, add an empty line between Partain Barbie Pabi, OK, you remember I just I showed you
several times in previous videos how to create a an empty line.
And this is just going to be for separating the output's inside the run console once we run all these
assignments.
So it won't be mixed like all the output's won't be mixed.
OK, so from here, let's go to part B right here in part B, I just want you to use the same list.
Don't even create it again.
Just just, you know, create a wire loop and inside the wire loop, you should use this list.
All right.
There's no need to create an additional E duplicate this one.
No need for that aim.
All right.
To create a new Y loop with the same with the same stop condition as in part A.
OK, here we have this stop stop condition.
And also, if the H is bigger than 20, stop the wire loop from inside.
OK, we have discussed this topic as well in the advanced lectures, in these advanced lecture.
How can we stop a while loop from inside.
All right.
Regardless of the regardless of the condition that we have inside the wire loop itself, like the condition
that we have in the wire loop, obviously is while.
While X is smaller than 10, so this is the stop condition once it becomes false, so the Y stops to
run, but we also learned how can we stop it from inside the wild, from right here.
All right.
So just stop it using the topic that we have covered in the advanced lecture from inside the wild.
All right.
And right before you stop the pretested value out of the list, I want you to print out the value that
caused the stop.
All right?
Because we want if ages is bigger, if age is bigger than 20, then stop the.
So please print the value that caused this stop to be initiated.
All right, from here, let's go to party, all right.
So please create a while loop based on the list from point A, but this time looks condition should
check whether the age is smaller than 74.
All right.
Whether the age is smaller, I actually want to change it.
If the age is smaller than 70, right on each cycle of the loop, change lists sales to be plus two
and printed.
OK, so we have learned in the lists, lists, lecture, how can we change cell values?
And I want you on each cycle of this while to add plus two to the existing cell value.
Right.
So please recall, how do you do it?
And if you don't remember, just go back to this lecture and see how we are doing it over there.
And at the end, if the loop reaches to the number seventy two, we changed it to 70.
It should run and part with the print I'm inside or else because of and then print here the least cell
that caused it to go inside inside the cells.
OK, so once that number reaches 270, which is our condition.
All right, we have only the condition here.
The condition is the wire loops, the wireless condition.
Right.
So once it reaches 270, it should go to else.
And once you go to else, print this line, I'm inside or else because ofthe and mentioned here that
liste cell value.
OK, I think that's that's about it.
Again, I don't want to give you some additional hints because I think it's pretty clear what to do
here.
It doesn't mean that these assignments are not challenging.
Right.
When I'm saying it's clear what to do, meaning that it's clear that you need to fight with the code.
You need to struggle until you get to the solution.
It's not meant to be easy.
All right.
But I'm sure and I know that you have all of the tools to resolve all of these assignments by yourselves,
surely by 100 percent.
All right.
And if you get into trouble, that that's OK as well.
So you can watch the next video.
Well, I give you the answers for these assignments, and you also can verify your answers by watching
the next video.
Thank you.
And we'll see you in the next lecture.