Operators are used to perform operations on variables and values.
Operation | Description |
---|---|
x + y | Addition |
x - y | Subtraction |
x * y | Multipication |
x / y | Division -> result is float |
x // y | Division -> result is int |
x % y | Remainder of x / y for positive x, y |
x ** y | x to the power y |
They can be created by comparing values by using the rational operators
We can use membership operators to test if a sequence is presented in an object:
>>> x = 2
>>> y = [2,4]
>>> x in y
True