(Sep-13-2019, 08:33 AM)ankitdixit Wrote: Hello Everyone,
Why Is The “Pass” Keyword Used For In Python?
>>> if x==0:
pass
else:
print "x!=0"
Anyone tell me why it is used in python or Anyone tells me best wat to learn python. I want to explore more about python coding.
In spoken language it's: 'if x is equal zero do nothing, else print that x is not equal to zero.'. However, in spoken language and in Python it usually expressed:
# spoken language: "if x is not equal to zero notify the user about that" if x != 0: print('x != 0')EDIT:
Of course there is built-in help in Python (press 'q' key to exit help):
>>> help('pass') The "pass" statement ******************** pass_stmt ::= "pass" "pass" is a null operation — when it is executed, nothing happens. It is useful as a placeholder when a statement is required syntactically, but no code needs to be executed, for example: def f(arg): pass # a function that does nothing (yet) class C: pass # a class with no methods (yet) (END)
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.