Python Arithmetic Operators

Arithmetic operators are one of the Python operators and we can use them to perform calculations like addition, subtraction, multiplication, etc. In this lesson, I’ll show you the different options.

Addition

We can add two or more numbers together:

>>> 1 + 1

Will show this output:

2

Subtraction

Subtract a value:

>>> 5-1

Will show this output:

4

Multiplication

We can also multiply two values:

>>> 4 * 4

Will show this output:

16

Division

Or do a division:

>>> 9 / 3

Will show this output:

3.0

Modulus

We can also calculate the remainder of a division:

>>> 11 % 3

Will show this output:

2

Exponentiation

Exponential calculations are also possible:

Sign up for FREE to Continue Reading

Here's what you'll get:

  • Full Access to this lesson + 387 more.
  • Learn CCNA, CCNP and CCIE R&S. Explained as simple as possible.
  • Unlock Access to 424 lessons by becoming a member.
  • New Lessons Added Regularly. You'll Be the First to Know.
  • Content created by Rene Molenaar (CCIE #41726)

Takes 1 minute - No credit card needed


Ask a question or start a discussion by visiting our Community Forum