Skip to content
Menu
Code for Java c
  • Home
  • Java
    • Java Examples
    • Java tutorials
  • C
    • C tutorials
    • C Examples
  • C++
    • C++ Tutorials
    • C++ Examples
  • Python
    • Python Tutorials
    • Python Examples
  • About
    • About me
    • contact us
    • disclaimer
    • Privacy Policy
Code for Java c

Pass statement in Python language

Posted on October 29, 2017September 23, 2019

Pass statement in Python language

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

This for loop has no implementation
When we executed the above code, it produced the following results.

Display error message

Same for loop, there is no implementation but consists of pass statement. We can implement future.

When we executed the above code, it produced the following results.

No error but no output.

Example 2

This while loop has no implementation.
 
When we executed the above code, it produced the following results.
Display error message

When we executed the above code, it produced the following results.

 The while loop, no implementation but consists of pass statement. we can implement future.

No error but no output

Example 3

This method has no implementation.
When we executed the above code, it produced the following results.

Display of error message

 

Same method, no implementation but consist pass statement, we can implement future

When we executed the above code, it produced the following results

No error but no output

Example 4
This class has no implementation.
When we executed the above code, it produced the following results

Display error message

Same class, no implementation but consist pass statement, we can implement future

When we executed the above code, it produced the following results

No error but no output

Some example programs with pass

Program 1

Pass statement in Python language
Example

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

Pass statement in Python language
Example

When we executed the above program, it produced the following results

1 3 5 7 9

Related post

for loop with the pass break continue statements

while loop with pass break continue statements

Continue in C Language

Break in C Language

Continue in Python

 

Related

Recent Posts

  • Subtract two numbers using method overriding
  • PHP Star triangle Pattern program
  • Using function or method to Write temperature conversion : Fahrenheit into Celsius
  • Function or method:temperature conversion from Fahrenheit into Celsius – Entered by user
  • Write temperature conversion program: Fahrenheit into Celsius
  • How to write a program to convert Fahrenheit into Celsius

tag

Addition (6) Array (38) C++ language (91) C language (98) c sharp (23) Division (6) Function (29) if else (32) Java language (102) JavaScript (5) loops (137) Multiply (7) Oop (2) patterns (65) PHP (13) Python Language (38) Subtraction (7) temperature (20)

Archives

Categories

Address

Global information technology

Puloly south, PointPedro

Jaffna

Srilanka

©2025 Code for Java c | Powered by SuperbThemes