Python for Data Analytics • Lesson 4

Numbers & Arithmetic

Learn how Python performs calculations using arithmetic operators, including addition, subtraction, multiplication, division, modulus, floor division and exponentiation.

Your progress0%

0 of 8 concepts completed

Complete the activity and related MCQ to unlock the next concept.

Concept 1+ and -

Addition and Subtraction

The + operator adds two numbers and the - operator subtracts. Both work with numbers, with variables, and even with a mix of both — as long as the values are numeric.

Learn by Seeing

Basic addition and subtraction

10 + 5     # 15
20 - 8     # 12

a = 25
b = 15
print(a + b)  # 40
print(a - b)  # 10

Operators combine numeric values; the result is stored or printed.

Change the numbers and operator — see the live result:

25 + 15

= 40

Interactive Activity

What is 25 + 15?

Hint: Simple integer addition.

Python Analyst Mindset

Every calculation is an analyst's tool

Revenue, margin, growth rate, average order value, even a simple "is this divisible by 12" check — they all come down to these seven operators. Once you know them, you can express any business formula in Python.

01

Add / Subtract

Totals and differences.

02

Multiply

Line totals and revenue.

03

Divide

Averages and ratios.

04

% // **

Remainders, floor, powers.

Frequently Asked Questions

Numbers & Arithmetic — FAQs

Why does 20 / 5 return 4.0 instead of 4?

Python's / operator always returns a float, even when the division comes out even. Use // to get an int.

How is % different from //?

% returns the remainder of division, // returns the whole number of times the divisor fits.

Does Python evaluate left-to-right?

Not always. Precedence rules (then left-to-right for same-precedence operators) apply: ** first, then * / // %, then + -.

What does -7 // 2 give?

-4. Floor division always rounds toward negative infinity, not toward zero.

Lesson Summary

What you learned

+ - *

Addition, subtraction and multiplication.

/

Normal division, always returns a float.

% //

Remainder and floor division.

**

Exponentiation — raising to a power.

Order of operations

** first, then * / // %, then + -. Parentheses override.

Analyst patterns

price × quantity, total − discount, remainder checks.