Summary of Expression TypesΒΆ

Expression

Arithmetic meaning

1 + 2

Addition, the result is 3

3 * 4

Multiplication, the result is 12

1 / 3

Integer division, the result is 0 in older Python environments, but 0.333333333333 in Python 3

2.0 / 4.0

Division, the result is 0.5, since you are using decimal numbers in the calculation

2 % 3

Modulo (remainder), the result is 2

-1

Negation, the result is -1

You have attempted of activities on this page