top of page
Writer's pictureRajesh Singh

Pass Statement in Python

Updated: Feb 25, 2021



The pass statement acts as a placeholder and frequently used when there is no need of code but a statement is still essential to make a code syntactically correct. A python comment works similar to the pass statement as it does nothing so we can use comment in place of pass statement. A comment is completely ignored by the Python interpreter whereas pass is not ignored by interpreter, it says the interpreter to do nothing.



Example:

for n in [10, 11, 9, 76, 4, 7, 52]:

if n%2 == 0:

pass

else:

print(n)


Output:

11

9

7



16 views0 comments

Recent Posts

See All

Files MCQ in Python

File Processing MCQ Q1. Which function writes a list of lines in File? A.      Writelines() B.      Write() C.      Tell() D.      All of...

Python List MCQ Questions

Q1. What is output of below python code? dict= {1:'1', 2:'2', 3:'3'} del dict[1] dict[1] = '10' del dict[2] print (len(dict)) A. 1 B. 2...

Python NUMPY MCQ Questions

Python NumPy Chapter MCQ: 1. What will be print? Import numpy as np a = np. array([1,2,3,5,8]) b = np. array([0,3,4,2,1]) c = a+b c = c*a...

Kommentare


bottom of page