2. Module 1 Operators
Basic operators
+ - * / // % **
Data and operators when connected
together form expressions.
3. Module 1 Operators
Exponentiation, multiplication
print(2 ** 3)
print(2 ** 3.)
print(2. ** 3)
print(2. ** 3.)
8
8.0
8.0
8.0
When both ** arguments are integers, the result is
an integer, too;
When at least one ** argument is a float, the result
is a float, too.
print(2 * 3)
print(2 * 3.)
print(2. * 3)
print(2. * 3.)
6
6.0
6.0
6.0
7. Module 1 Operators
Key takeaways
• An expression is a combination of values;
• Operators are special symbols or keywords;
• Arithmetic operators in Python;
• A unary operator, a binary operator;
• The hierarchy of priorities;
• The exponentiation operator uses right-sided binding.