What is use of pass statement in Python?-tccicomputercoaching.com

Page 1

What is use of pass statement in Python?tccicomputercoaching.com The pass statement. pass_stmt: "pass". pass is a null operation -- when it is executed, nothing happens. Use the pass statement to indicate empty functions, classes and loops. With pass, we indicate a "null" block. Pass can be placed on the same line, or on a separate line. Pass can be used to quickly add things that are unimplemented.

Example: str="Hello" for i in str: if i=='H': pass print("pass is executed:") else: print(i) Output: pass is executed e


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.
What is use of pass statement in Python?-tccicomputercoaching.com by Rosario Riley - Issuu