Keywords Flashcards
and
Logical and
as
Part of the with-as statement
assert
Assert (ensure) that something is true
break
Stop this loop right now
class
Define a class
continue
Don’t process more of the loop, go back to the top and run it again
def
Define a function
del
Delete from dictionary
elif
Else if condition
else
Else condition
except
If an exception happens, do this
exec
Run a string as Python
finally
Exceptions or not, finally do this no matter what
for
Loop over a collection of things
from
Import specific parts of module
global
Declare that you want a global variable
if
If condition
import
Import a module (function) into this one to use
in
Part of the for-loops. Also a test of X in Y
is
Like == to test equality. More rigorous
lambda
Create a short anonymus function
not
Logical not
or
Logical or
pass
This block is empty
Print this string
raise
Raise an exception when things go wrong
return
Exit the function with a return value
try
Try this block, and if exception, go to except
while
While loop
with
With an expression as a variable do
yield
Pause here and return to caller