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

Before you keep reading...

Runestone Academy can only continue if we get support from individuals like you. As a student you are well aware of the high cost of textbooks. Our mission is to provide great books to you for free, but we ask that you consider a $10 donation, more if you can or less if $10 is a burden.

You have attempted 1 of 4 activities on this page