Keywords Flashcards
and
this is used when assessing truth to see if two values apply. It results in True only when both operands are true.
del
this is used to delete an object
from
this is used when importing specific functions from a module
not
this is used with truth assessments to specify the negative of the conditions (e.g. to invert the truth value)
while
used for loops that continue until a condition is no longer met (or goes on forever)
as
used to import a module as something else, under a different name
elif
in conjunction with an if statement and followed by an else statement, used for assessing conditions
global
this can be used in functions in order to modify a variable outside of the function - initialize the variable as global within the function once, then use it and it will update the variable throughout the program
or
used when comparing conditions (i.e. this or this) - it results to true if any of the operands are true
with
used to pair up lines of code - can help to close files (not super clear on this one)
assert
this is used to test assumptions. If the test isnt met then it returns an AssertionError
else
used with if statements to specify another condition that would result in set actions
if
used to test a condition and then carry out a specific action if that condition is met
pass
used when something is required syntaxically but the code doesnt need to do anything
yield
like a return statement in a function, yield returns a generator