Python Keywords



Python Keywords:

Python Keywords are special reserved words which have a special meaning to the python.
Each keyword have a special meaning and operation. 
These keywords can't be used as variable. 

TrueFalseNoneandas
assetdefclasscontinuebreak
elsefinallyelifdelexcept
globalforiffromimport
raisetryorreturnpass
nonlocalinnotislambda


Keywords Working:

print 
it is used to print statement.

while 
it is used to control the flow of the program.

for
it is used to iterate items again and again till some finite steps.

break
interrupt the (loop) cycle, if needed,come out of loop.

continue
used to skip steps in loop, without jumping out of the whole cycle. 

if
used to determine statements which are going to be executed.

elif
it is else if.If the first test evaluates to False,then it continues with the next one.

else
The statement under the else keyword is executed if first condition is False.

is
it tests for object identity.

not
alter the boolean value.

and
all conditions in a boolean expression must be true.

or
at least one condition must be true.

import
import other modules or package into a Python script.

as
if we want to give a module a different name.

from
for importing a specific package, class or a function from a module.

def
used to create a new user defined function or class.

return
exits the function and returns a value

lambda
creates a new anonymous function for syntax see python lamda.

global
we can access variables defined outside functions

try
specifies exception handling problems.

except
catches the exception and executes the code.

finally
is always executed in the end. 

raise
create or raise a user defined exception.

del
deletes the objects

pass
does nothing or simply pass the flow.

assert
used for some debugging purposes.

class
used to create new user defined objects.

exec
executes Python code dynamically.

yield
it is used with generators,it is used to yield or give output.

Post a Comment

0 Comments