Python Keywords

preview_player
Показать описание
A quick look at the keywords you should avoid when creating variables and the likes.

What do the keywords do?

print
print to console

while
controlling the flow of the program

for
iterate over items of a collection in order that they appear

break
interrupt the (loop) cycle, if needed

continue
used to interrupt the current cycle, without jumping out of the whole cycle.
New cycle will begin.

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

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

else
is optional. The statement after the else keyword is executed,
unless the condition is True

is
tests for object identity

not
negates a boolean value

and
all conditions in a boolean expression must be met

or
at least one condition must be met.

import
import other modules into a Python script

as
if we want to give a module a different alias

from
for importing a specific variable, class or a function from a module

def
used to create a new user defined function

return
exits the function and returns a value

lambda
creates a new anonymous function

global
access variables defined outside functions

try
specifies exception handlers

except
catches the exception and executes codes

finally
is always executed in the end. Used to clean up resources.

raise
create a user defined exception

del
deletes objects

pass
does nothing

assert
used for debugging purposes

class
used to create new user defined objects

exec
executes Python code dynamically

yield
is used with generators
Рекомендации по теме