python tutorial - Python Pass - learn python - python programming




What is Python Pass?

  • In Python programming, pass is a null statement.
  • The difference between a comment and pass statement in Python is that, while the interpreter ignores a comment entirely, pass is not ignored.
  •  python pass

    Learn Python - Python tutorial - python pass - Python examples - Python programs

  • However, nothing happens when pass is executed. It results into no operation (NOP).
  • It is used when a statement is required syntactically but you do not want any command or code to execute.
 python pass
  • When you do not want any code to execute, pass Statement is used.
  • It is same as the name refers to.
  • It just makes the control to pass by without executing any code.
  • If we want to bypass any code pass statement can be used.

Syntax:

pass  

Example:

for i in [1,2,3,4,5,6]:  
    if i==3:  
        pass  
        print "Pass when value is",i  
    print i,

Explanation:

  • When if condition gets true then that executes pass and print the “Pass when value is”.

Output:

	>>>   
	1 2 Pass when value is 3  
	3 4 5 6
	>>>  

Wikitechy tutorial site provides you all the learn python , python 3 online course , python scripting training , python training , python online course , learning with python , python programming training , learn python programming for beginners , learn python course , free online courses for python , courses in python

Related Searches to Python Pass

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

×