In this tutorial, we will discuss the concept of pass statement in Python language.
In the Python programming language, the pass is a keyword(statements) that is used to indicate when nothing happens – the loops(for, while), function and class are empty.
Syntex
Syntex of the pass statements
pass
We can use pass statement to indicate a null block or it can be used to quickly add items that are in the unimplemented block in python.
Example 1
Display error message
When we executed the above code, it produced the following results.
No error but no output.
Example 2
When we executed the above code, it produced the following results.
No error but no output
Example 3
Display of error message
When we executed the above code, it produced the following results
No error but no output
Display error message
When we executed the above code, it produced the following results
No error but no output
Some example programs with pass
Program 1
When we executed the above program, it produced the following results
number is:1
number is:2
number is:3
number is:4
number is:5
number is:6
number is:7
number is:8
number is:9
number is:10
Exit from loop
Program 2
When we executed the above program, it produced the following results
Subtract two numbers using method overriding Program 1
PHP Star triangle Pattern program Here's a simple Java program that demonstrates how to print…
Using Function or Method to Write to temperature conversion: Fahrenheit into Celsius In this article,…
Function or method of temperature conversion from Fahrenheit into Celsius In this article, we will…
Write temperature conversion program: from Fahrenheit to Celsius In this article, we will discuss the…
How to write a program to convert Fahrenheit into Celsius In this article, we will…
This website uses cookies.