Python 3 - EdDoc

EdDoc: home/python

Python key words and operators

The key words and operators available in Python 3.

Key words:

The following words are reserved and form the core vocabulary available in Python.

Section Description
and A logical operator used to check whether two conditions are satisfied.
as Used to assign a shorthand reference to a module.
assert (advanced) Used when debugging
break  
class  
continue  
def  
del  
elif  
else  
except  
False  
finally  
for  
from  
global  
if  
import  
in  
is  
lambda (advanced)
None  
nonlocal  
not  
or  
pass  
raise  
return  
True  
try  
while  
with  
yield (advanced)

Operators:

Operators are symbols that can be used in your programs. They are broadly speaking mathematical or logical symbols rather than words

Section Description
= assignment operator: Used when you assign a value to a variable name.
== equals operator: Used to compare values; returns True if they are the same.
!= not equals operator: Used to compare values; returns True if they are the different.
> greater than operator: Used to compare values; returns True if the first value is greater than the second.
< less than operator: Used to compare values; returns True if the first value is less than the second.
>= greater than or equals operator: Used to compare values; returns True if the first value is greater than or equal to the second.
<= less than or equals operator: Used to compare values; returns True if the first value is less than or equal to the second.
+ addition operator: Used to add two numeric values or combine two strings.
- subtraction operator: Used to subtract the second number from the first.
* multiplication operator: Used to multiply two values together.
** power operator: Used to raise a number to a certain power.
/ division operator: Used to divide the first number by the second.
// integer division operator: Returns the number of times the second number goes into the first completely.
% modulus operator: Returns the remainder after integer division.