Lecture 23

IIT Kanpur July 201
20 followers
Dec 1, 2023
Hello friends, you all are
very welcome to the course of Foundations of Art Software.
You will remember that in the last lecture we
talked about loops and we especially
tried to understand the following. So
today we take this goal forward
and here today instead of fabric, we will
talk about oil and repeat loops,
so now the first question that comes to you is what are
our repeat and while loops.
In what kind of condition do we use
Shruti from which you saw that when we
use follow then our first
condition is that
he knows how many times I have to repeat my program
but if it is not so then I know or I have
such a condition that something should happen that we
keep repeating this program until our work is completed. Do
you know
how many times you should repeat it in such cases like
whatever we do? You do relation, we do
acquisition, in that we keep
repeating our program again and again,
but it does not know
how many times it will be converted into practical after repeating it,
so in such a condition, we boil it. Let us
use that as long as this
condition of mine is satisfied then our
Yo Yo program will remain working
and in the same way you will see that
we do some similar work inside the repeat.
Let us start this letter and we We will
tell you about all these things gradually and we will
improve together, through which we will try to explain to you about the
functioning of a lemon and how it
works.
So let us start this letter. If we
do,
then as you remember we were just
talking about the control structure
and out of that we have first
talked about the control statement. We have
different types of distance education like
this etc. which are our monsoon.
Then we
talked about our functions which
control our program like switch
on which and after that today we are talking about loop
so in loop you saw that we have
three types There are people of, one
is Paul and repeat you so phone,
we have talked about it in the previous lecture
and today we will tell you about wine and repeat look,
so this is a quick
revision for you which is our for loop. It happens where
we work,
we use it when we do
not know in advance
how many times we have to repeat our program or our commands. The
right and its commands are repeated for
some time. We write 'for knee tractor'
here
we give whatever controlling variable we have and on this
controlling through email we try to control the
values that are present in this person
and also
write here. In these and subsequent
Weekly Rackets, on which we have to unite our comments,
we write
that now we talk about it viral here,
whereas we use Ruk in those places
where we have to do it earlier. I don't know
how many times do I have to repeat my program or my command, how to
improve that in this Pet 6, when we
talk about maximum light condition, we
but our heart function there
that through the previous active algorithm. If we
try to solve it, then I also
know that our solution will be found after repeating the program how many times
or
after straightening the program,
but we can definitely see
how many times we repeat this program. Do this
until we reach the point of
convergence, i.e. the difference between our previous
value and the current value of the program is
not more than one point, then on such condition we
use Viral Loop here. As
you have seen the meaning of 'wala' in Hindi,
till when till till till when the car
or as long as our condition is right, keep
doing this work,
then Ismail, look at the one which happens with the man in
such a way that we Let's
start our program whatever
our romance is and after that a
condition is given here and it is
seen whether this condition of ours is right
or wrong
then as per our condition if it is found
then Whatever we have given to our people is
always sent to their village and
it will come back to our Addition Valley
there and then it will come forward and it will
see the condition from it to see if this condition
is correct and if If this collection is correct, then
again it will come forward and it will unite these commands again and by doing this again the
initial will come
up and this process will
keep happening again and again until the condition that somewhere
remains two remains and As soon as the condition of Kareena's pass is
not cleared, the
program will come forward from here
and whatever is written outside the look of that program
will be instituted and or if you have to
select here. So, it will end the program. In
this way, this is our white look
worker. So, let us
first see how it is written in the command
and to write this white look in the software,
our The command goes viral
WHILE, we will
write everything in our alphabet and after that we
parents will write our condition in it
which we want to search, then the
answer to this condition will be either Aa Tu or
this. The focus here is that
our zip program will work as long as
our condition remains true and
we give the commands for which tasks it will perform here
inside this close racket,
so as long as our condition remains true.
All the commands of the star written inside Ali Baig will keep uniting again and again
and as the action falls, our
control will come out of this street cricket
that if you give your conditions to
enter in this look. There is no
day after that,
whatever we earn within those looks will
not be executed by anyone. If
our condition is passed then
our dead control will
come out of this world of street cricket and no one will come before it. Also,
if less is written then it will remain empty
but none of our commands written under the Act will be executed,
so now let us try to
understand it through a small example
and this concept. Which we have
done which are similar to our fore look
where it becomes easy for you to understand
and you can also complete that what is the difference between fore and
white look care in the application in which we
earn in this way.
So our objective here is very
small that we take some number
one and next to that we will keep adding people two by two to it
and will keep pinning the
values that came to us.
And this printing will
continue till the owner as long as our vegetables are
left on the side, so for this we
wrote equal to one, then I boil
subscribe,
whatever is ours, it will be 10 small,
till it remains whatever
we have written. These will
remain ours and send from our village that I have pranked here
and after that they will replace our and our two plus two
plus two and now they will
score. Now
let's first see what is this
program of ours. If it will work properly then the
first thing that comes is that when it starts,
its value will be I *
one-click Where will it come from here that A
and after that a controller will come down to you
and this cross will decide that I is this lt.
10 The answer comes, you will check it here,
only after this it will say that
print this is where
1 on this here and
after that it will say that add
two to the current value. If this is done then it will go
one plus two equals two three will be here
and after doing this from here, this is
our control, this is my vote and
will come back here,
now the value of what came here is three,
save it in this then It will check if the value of i is
small by 10, the answer will be true, then
this is again whatever our value is,
so it will print it on this and
after that it will replace i like free
plus two i.e. 5
in my office.
Cooked the control air and again here now it
will show that I equal to five but is the
condition true that I lashes sentence answer
comes true then again it will clear the preface here
and after that will
change the free equivalent to Five plus two
and it will go hard when this value
comes our payment then again this our control
viral will present the same condition again and by
taking it here but with high school and I will
check that is it 10 small the
answer will come through And if this answer is two, then
it will print seventh on this and the partner will
change the i to seven plus two so that its
value becomes nine now after this when after this is
no longer going to be our next they war
will be iodine and this again Will this interest my wife's
condition? Then I checked again
whether our phone is
Nokia 10 small. If the answer comes then it will
again prince our home in Noida
and what will be the value of phone with it.
9 -2-11 And after that you have to pay attention
to what will happen here, now here the value of I has come
lemon, then again someone has come 211,
our route from here will go to this wild condition
and it will work whether
I The value of 10 is small and the answer is that the
force is wrong, so here we program this
form and this control will
come out of this street and this is what you are
subscribed to here,
which I have taken out, see here,
so you You can see that uniting it here
is a very easy task and before proceeding further, let
us show you this body by
doing it in the art software
of Surya, you will get confidence that it is right
but the important thing for you is that
how you If you
understand it, then look at the program that you have
written here that will give you this amount of money. Let
us take another example for you and
in this example we will show you something else,
so this is what I have written for look. I had also taken an example
where I used a function,
so here I also told you
that what functions are our programs
and how we write them,
so here we will repeat the same thing again.
But we will use it here
and
what is our objective here, our objective is
that we want to do something that someone will
ask me tell me any number below 25
and what we want to do is that whatever
our The number is
that from the next till 25 we will have all the
interiors
that we want to do with each other,
like if we say that you asked us to
tell us any number which is less than 25,
I said, yours is eighteen, then it is less than 18. We 18 plus
19 plus-20 up to here 25 sure we
want to find the value so how to do this task
now to do this task
you keep in mind that I am here 21
and command honey earn a grid line and a
From were, we are using them, we will
tell you about it later, but their command is
used so much that when we
try to shift any lines and from
is, our program gives the form there,
as you have seen that many of our The
program sleeps that when we enter any value
there, the
program that moves ahead will
do the same, so let us first
write the function on it and we will
explain this program to you and its Later we will
see how it works,
so first of all I have taken the function here,
after that I have
not given any input in it, Princess, because your input will
come from the middle of the same program, so I have left
it blank.
After that see the street
number-1 and this number one, in the middle of this I
want to delete my comment
and after that I took one of my
initial variables and I made its value
Devi zero, so this is welcome,
I named it sum. And in this we have
added these flights, now after that we have to
write a comment like this, here we want
to unify the program, so
ask us also that you enter any number less than 125 to
get this award. For this, I wrote something like this,
I used the first command, edit
interior portion, tell me what this daughter will
do, it needs to be told, you
first see,
many people have done it, then in the same
way this is the acid which will be ours,
convert it into After that we use here
and do here and also
write please like number 90 i.e.
25, we are looking for any smaller number.
Now what we have to do after this is see
if there is something above the number then our
program is here. It will be finished
but if the number is less than 25 then
we need its less, so I have written here '
viol' and here I have written the
condition 'this princess' is inside it
that as long as our number is less than or
equal to 25, where will this number come from? Look, this is the
number
which is punctured
and for how long do you do it, you replace the time
with the sum plus number, so in the first session,
where will something you come from, this is the initial
value and the number where will they come from, this is what
you have given here. And after that
you replace the number with number plus one, that is,
you give a joke based on the number given by you
and try to do the same thing that I have written inside this car, whatever is
our, this bud, back to. I am
doing this, become
a stranger, after this you print it and
paste it, that is, whatever
statement we want to present, along with the
value, what happens to this PACE also,
we will tell you about it
in more detail later. Try this, this is a lot of
our comments and to see something,
we want to write here the
sum of number service from dawai loop and
next to that, here we have the value of whatever sum has
come from where and which is final. Value comes
from here we want to write it, so if
you try to understand then how will it work for us,
first of all he took it as if he was
Ltd. and he asked you to enter some number for us
but which is good. If it is small then
I have taken the number so it
is 23. Now see what will happen here
that now this control will come here and
from where will it do it. Is this number of ours
less than 25? The answer will come yes then what will it
do, give it which state. Take this will unite
that sum easy kuntu the value of the sum will come
204 number that how much they have come is these three
and after that what will do to the number will
replace the number number plus one is
equal to solve this
is now after that What will this number
24 of ours do, it will be negated and again this
condition of ours will decide
whether this number of ours is less than 25. The answer comes
here, so again this is ours which will make the commando as
easy as Kuntu. Our time which came earlier will be
three and will add the number to it
2324 and this will add the number and will
change the number again which mother does first mother
24 plus one equal to two purchase and this will
go to our 25 and 25 Later on it will know
that whatever number comes after 25 will
be 26 and here it will stop it
and in the same way if we see here if we
enter Sappoch one number is 3
I am like this Prakash too By doing 3 4 5 6
it will come till 25, so let us show you this
function in eight software.
Before we show you
how to execute it,
first of all you will see
here. Evening function, whatever name of the function is
given and you will write after wearing it, you do
not have to write anything in it and after that it will
ask you that please like any number Lansdowne
inch, now give your number here, take 22,
so now see this and it will ask you the The sum
of number received from the white luv is 9494.
Where did it come from? Good bye. If you subscribe
then its value will be 94 and if you are
also subscribed, then
before moving ahead, let us make a little
note of this and
show you how to do it in other software. Look at
this, here we have copied this program of ours,
it will save my time
and if you see, your
programmed evening function is like this,
torch light, if you follow any program, if
you assume that if you
[ Music] If you
want to use it, then how will you do it?
If you call any function as reaction function and then
you write these words here, then you will
see that it will be done, as soon as you enter, it will
ask please select any number, then you
do this. So you see the number
given here
is 94 and in the same way if we
repeat any massage function here
and here we give the number support
now we will see that in this we have given you the number 16.
Look at the value of which, this is how you
reduce the SIM, you will
see that
hands free is 22.2,
so you have seen that
repeating and uniting this program is not a very difficult task
and let us change the font size of our screen.
Stay outside as if you will
not face any problem in looking in Bollywood further and
now after this we will
talk about our next loop which is now P.
I have seen you in this way that
you do not see this inside that look. Know how many times
you have to combine the potatoes or how many
times you have to use the loop, how many
times you have to repeat your function program, the
reverse of that is in the form of repeat here
and here we have this program as
commando. It is our programmer's choice as to how many times the program has to be repeated
and it is his responsibility to decide
how many times he has to
repeat the program according to the type of commander he is there and
After that, we will
do an amazing use of a function here and after that
our program will come out of the tree. Regarding back, do
you remember that we had to
talk about break and next in our previous lecture, so let's go. Let us explain to you by taking an example here,
but before that you should
understand how the repeat command will be given
in R journey, which is very easy,
you simply write repeat rspct here
and after that in the bud brackets, write all the
commands. Have to be written, you write them here,
I will explain to you with an example, it will be
understood very easily, so see,
here we have taken the plant which we had
taken earlier, here we will take a number and that
number We will try to print
and every time we will add two to the next number so that the
ward number of this budget will be more than 2
and this process will continue
till our number becomes more than 10
so now let us see. So here I
wrote equal to one so about this
I wrote that on the back and after that inside this bud
packet, the number one which we have taken is number one
here I earn my in the middle of this
I have done amazing one print i square
and After that I changed IG to *I
plus two i.e. replace the value of I
with the object and then we gave the referee condition
that then this is great and the
value of 0128 JCI is filled with Mary 10
then this program If you stop here,
then see how our program will
work. First of all, one is
God and from this it will print i i.e.
square, after this it will change the value of i,
like one plus two, it becomes 3
and then After this agrotech will decide whether the
value of eye is more than 10. He will
preside over whether the eye is that war
prince and if it comes down then you will
stop it but it comes down falls on
that your height is three in Delhi. So
now what will it do in the next step which is
our i key value is scene or take this and then
use this amazing that this
print is a then it will be free freezer
and after that it will come to post the i key value. If it is then
Ai will become bigger,
C plus two is equal to five, the office will run
whether our Ai is more than 10
and our answer will be false here
because the rest of the diseases are five, so
what will it do now, taking the value of Ai by five
and doing Yagya.
And this is our command, we will repeat this command again
next time and it will be
equal to two parts, our
print five will come on this end day from here, we will hit I, we will
hit part plus two, that is, the
officer will say that our I is afraid. If it is more then
intake is our 10 more otherwise
this question will be our calls Now what will it
do that now here high school puja will take intake
and will print again prints sexual
and again will change the value of i seventh
plus two which which is our It will become nine and
again it will question whether what is
our Nan is more than our fear, the
falls will come down, then it will again
come to our place here and it will take the value of I* note
and print it again.
Noida sector and after that it
will bring some two 9 inch plus two which will be ours
11:00 Now here you have to understand that
see what happens affection like you here the
value of the eleven and it checked this condition
IS Greater Than 20 This question was answered
correctly
because the time is correct on the day of lemon juice
and as it happened, this program has been
braked here and here your program will stop and
this is what you see here and you will see less.
Warning Square Feet that
organizing this festival is a very
easy task and we
also give you one more thing in this that
you can subscribe in the same way as you have used here.
I know you have done the
gruel so we take it here
and change the condition here that we
program and should repeat
inside number one here what we will do is
this
and if our person and
then Our next person then
our A Friend IS will be cleared
and after that as the value of our I will be
filled with festival, this means the
program will stop here. Now from here
try to understand
how it works. C You took
here I any am here Now if you
repeat it then this is done to you I to *
I plus one i.e. OnePlus one equal to two
Now after that it will work to
this What
is the value of high 10 is small I will be the
president, the answer is Ajay's or two's
value is 10 small, that Ajay's U's
tortoise will go, you will say, what to do now,
next, so it will take you here, whatever is the
next value of I's, it will take
equal. To
that someone will go here a lot, there will be tubeless one,
3G
in the office, we will check whether the
person in the team is small, the answer will come,
someone has hands, again you will get the next value of I
and how long will this value continue till
your The eye will come somewhere distant
ninth
and after that also it will come equal to 9 inches
plus one and here when you will see that the
tennis court is done, then till here
this condition of ours will be our ES file
because you have to buy eye lens day
10. :00 That means the value of i should be 10 small
and like here or commission will be for
it will print you is clear that
tennis player and after that again
this chain of a sycamore is plus one and will see that
this condition is our But it is clarified that
1110 is small, it will again print
Reliance Care and in the same way you will
proceed and it will print the printed festival
30 and after that as our
condition comes here that this is greater than or
equal. To torn means I will
become ours where 14 will bread it and
it will stop the program here so
see your similar type of money will be earned and
look at the screenshot so you see that
uniting this program is a very
easy task. And let's just show you this by doing it in our own
software
so that you get confidence. Now to
save it in the show, I copy this program
here and present it in my art
software and see this.
I enter, you will get this type of
answer here,
that now we
stop here in our liquid and you saw that
here we talk about follow and repeat,
now in these conditions, which
loop will you get? It is up to you to decide whether to use it.
I have told you about their use
by and in these conditions,
so now it is
your turn to take some examples and
whatever media you work in.
See the subject there, where all the tasks are
done and give
you a
subscription for those tasks and after that you have
tried to integrate it in the software
and for that you can write small rough programs and
write functions. Or you
can use whatever is less easy and we will talk about Honey Singh in the
next goal also, so
you will not have to wait too long to use the
function which I have used
in this lecture. If you are going to face this
problem, then you will
not have any difficulty and by the time you understand the concept of your potato and
how its functions work,
we will have covered the functions also,
so let us tell you. We will
tell you about the function in the next election, till then you
practice and we will meet you again in the next phase. Till then
goodbye
Jai Hind [
Music]
Bhindi bhindi kar
do
ki a
[Music]
