What is the statement that can be used in Python if a statement is required syntactically but the program requires no action?

Questions by GregMark   answers by GregMark

Showing Answers 1 - 28 of 28 Answers

Nagappan

  • Nov 13th, 2007
 

pass is a no-operation/action statement in python

# If we want to load a module and if it doesn't exist, let us not bother, let us try to do other task. The following example demonstrates that.

try:
    import module1
except:
    pass

suba

  • Aug 30th, 2011
 

Pass

  Was this answer useful?  Yes

Jayavanth

  • Apr 29th, 2013
 

Pass statement

  Was this answer useful?  Yes

Sreekrishnan r

  • Jun 25th, 2014
 

Pass

  Was this answer useful?  Yes

Pat Claffey

  • May 13th, 2015
 

The pass statement is a null operation; nothing happens when it executes. Note that the statement is "pass" in lowercase. If you type "Pass" you get an error "NameError: name Pass is not defined". Python statements are case sensitive.

  Was this answer useful?  Yes

The pass statement is a null operation. Nothing happens when it executes

Code
  1. letter ="hai sethuraman"

  2. for i in letter:

  3.        if i == "a":

  4.             pass

  5.             print "pass statement is execute .............."

  6.         else :

  7.             print i

  8.  

  Was this answer useful?  Yes

Ravindra Kumar Singh

  • Jul 6th, 2017
 

use pass keyword over there.
like :
if a>0:
print "Hello"
else:
pass
pass keyword is used to do nothing but it fulfill the syntactical requirements.

  Was this answer useful?  Yes

DT

  • Jul 6th, 2017
 

Pass

Code
  1. try x[10]:

  2. print(x)

  3. except:

  4. pass

  5.  

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions