Pass Statement in Python

Updated: Feb 25



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



13 views0 comments

Recent Posts

See All

Python Modules

A module is a file containing Python definitions and statements. A module can characterize functions, classes and variables. A module can likewise incorporate runnable code. Gathering related code int

 

9555593818

Thakurdwara, Uttar Pradesh 244601, India

  • Facebook
  • Twitter
  • LinkedIn