it with ‘continue’. As you can see in the output except the letter ‘e’ all the other letters get printed. (iii) pass statement pass statement in Python programming is a null statement. pass statement when executed by the interpreter it is completely ignored.
Nothing happens when pass is executed, it results in no operation. pass statement can be used in ‘if’ clause as well as within loop construct, when you do not want any statements or commands within that block to be executed. Syntax: pass a=int (input(“Enter any number :”)) if (a== ): pass else: print (“non zero value is accepted”) Output: Enter any number : non zero value is accepted When the above code is executed if the input value is (zero) then no action will be performed, for all the other input values the output will be as follows: Example . : Program to illustrate the use of pass statement pass statement is generally used as a placeholder.
When we have a loop or function that is to be implemented in the future and not now, we cannot develop such functions or loops with empty body segment because the interpreter would raise an error. So, to avoid this we can use pass statement to construct a body that does nothing. Note 12th Computer Chapter - - Control Structures for val in “Computer”: pass print (“End of the loop, loop structure will be built in future”) Output: End of the loop, loop structure will be built in future. Example .
: Program to illustrate the use of pass statement in for loop • Programs consists of statements which are executed in sequence, to alter the flow we use control statements. • A program statement that causes a jump of control from one part of the program to another is called control structure or control statement. • Three types of flow of control are o Sequencing o Branching or Alternative o Iteration • In Python, branching is done using various forms of ‘if’ structures. • Indentation plays a vital role in Python programming, it is the indentation that