Control structures

Lesson Details:
September 17, 2020

Video Transcription: In this lecture I'm going to talk about programming constructs this video is brought to you by Appy Pie’s Academy, programming constructs are also called control structures they are basically the building blocks of a program they have got three categories sequence selection iteration sequence a first I will talk about sequence actually a sequence is nothing else but it is a program which has been returned in a very sequential manner that means no statement one or more statements are getting executed more than once later on we will come to know that execution of a statement or a set of statements time and again that is repeatedly is called a loop iteration no I tration is taking place neither there are any checks like if this condition is true this statement is or statements are to be executed else some other set of statements are to be executed that means no statement will be missed to execute all the statements will be executed in a sequential manner this is a program which we have already done in one of our previous lectures so I have taken this program to give you an example of sequence so this is just a sequence no repetition and no missing of any statement now we come to selection see selection is basically decision making and this is considered to be one of the very powerful features of a computer system because based upon our conditions the computer can take decisions with statements to execute and with statements not to execute in Python selection is implemented using a statement called if statement now if statement can be implemented using simple F if with else nested if if-else if later etcetera don't worry we will be talking about these simple types later on so what is selection it is decision-making process in order to make you comfortable with decision-making process I have come with the flow chart where are the two flow charts flow chart is a pictorial representation of flow of logic right suppose I want to get bigger of two numbers so this is this indicates the start of the flow chart input two numbers a and B right we will be inputting two numbers through the keyboard then this diamond box it denotes the it denotes the condition making so we are making the condition that a greater than B if this condition is true what will happen is the control will go to this side yeah if a is greater than B then we are going to print a and here the the the execution will stop and this is your stop button now we again come back to this diamond box which is used for condition making if a greater than B condition is false in that case what does it mean is B is the bigger number so we will be printing B and then control will come down to this stop let's have another flow chart flow chart of the biggest of three numbers you might have some difficulty understanding this flow chart but don't worry we people will be writing a Python program to find out the biggest of three numbers also this is the start input three numbers ABC these are the variables ABC will be making the check if a greater than B this is your decision box if this condition is true it will go to this side now if a is greater than B that does not mean a is going to be the biggest number why because we are yet to compare a with C so I will check if a is greater than C suppose this condition 2 is true then a will be printed because a is going to be the biggest number similarly you can check the other paths also so what is decision making is decision making is the process in which the probe makes a condition and in the event of condition some set of statements are to be executed or it may be a single statement also and if the condition is false some other set of statements or a single statement is to be executed we will be implementing the if statement using the Python programs but before that I would in the next lecture I would explain about attrition

loader
Course content