Home » Python Tutorial » Python Pass Statement with Examples

Python Pass Statement with Examples

The Python pass statement is used as a placeholder for future code. Pass in Python is the same as a comment. It does nothing in Python code. The difference between pass and comment is, the Python interpreter ignores comments written in the code, but the pass statement is not ignored. The empty code blocks are not allowed in Python so that the pass statement is used as a null statement in Python. Let’s see an example of a pass statement.

Python Pass Statement Example

a = int(input("Enter first number"))
b = int(input("Enter second number"))
if(a==0 and b==0):


Enter first number10
Enter second number2

If one of the inputs is zero in the above code, then the division is not possible. So that we used the pass statement, if both numbers are non zero then only the division is possible.


What does pass mean in Python?

A pass statement is a null statement that does nothing in the code. This statement is used to create an empty function, class, or block of code.

Did you know?
1. Binary Search in Python
2. Polymorphism in Python
3. Python return
4. Python Strftime
5. Encapsulation in Python
6. Operator Overloading in Python
7. iloc in Python
8. Python Pop
9. Python Enum
10. Python Pass

Pin It on Pinterest