Page 163 - Information_Practice_Fliipbook_Class11
P. 163
6.9 pass Statement
A pass statement is ignored by the Python interpreter. It has the following simple syntax:
pass
It is often used as a stub when we want to leave some functionality to be defined in the future. For example, pass
statement can be used when no action is required on some conditions. For example,
01 for letter in 'world':
02 if letter == 'l':
03 pass
04 else:
05 print(letter, end='')
06
Sample Output:
word
It is important to remember that only the pass statement is ignored, other statements if any in the block are not
ignored. For example,
01 for letter in 'world':
02 if letter == 'l':
03 pass
04 print(letter, end ='')
05 else:
06 print(letter, end='')
07
Sample Output:
world
Answer the following in one word:
a. A statement that stops further iterations of a loop.
b. A loop inside the body of another loop.
c. A statement that does nothing.
d. A statement that starts the next iteration of a loop.
C T 05 What will be the output produced on the execution of the following code snippet:
for letter in 'world':
if letter == 'l':
pass
print(letter, end ='')
print(letter, end='')
Looping in Python 149

