Subscribe Contact

Home  »  Reference Materials



Python Keywords

KeywordDescription
andA logical operator
asTo create an alias
assertFor debugging
breakTo break out of a loop
classTo define a class
continueTo continue to the next iteration of a loop
defTo define a function
delTo delete an object
elifUsed in conditional statements, same as else if
elseUsed in conditional statements
exceptUsed with exceptions, what to do when an exception occurs
FalseBoolean value, result of comparison operations
finally with exceptions, a block of code that will be executed no matter if there is an exception or not
forTo create a for loop
fromTo import specific parts of a module
globalTo declare a global variable
ifTo make a conditional statement
importTo import a module
inTo check if a value is present in a list, tuple, etc.
isTo test if two variables are equal
lambdaTo create an anonymous function
NoneRepresents a null value
nonlocal declare a non-local variable
not logical operator
or logical operator
pass null statement, a statement that will do nothing
return To exit a function and return a value
raiseTo raise an exception
True value, result of comparison operations
tryTo make a try...except statement
whileTo create a while loop
withUsed to simplify exception handling
yieldTo end a function, returns a generator


«  Previous : Reference : File Object Methods
Next : Reference : List Methods  »




© 2023 John Gordon
Cascade Street Publishing, LLC