Variables & Data Types

Numbers in Python

Python handles different types of numbers automatically.

Integers (int)

Whole numbers, positive or negative:

age = 25
temperature = -10

Floats (float)

Decimal numbers:

price = 19.99
pi = 3.14159

Basic Math Operations

OperatorDescriptionExample
+
Addition
5 + 3
→ 8
-
Subtraction
5 - 3
→ 2
*
Multiplication
5 * 3
→ 15
/
Division
5 / 2
→ 2.5
//
Floor Division
5 // 2
→ 2
%
Modulus
5 % 2
→ 1
**
Exponent
5 ** 2
→ 25
Visualizer
$ python math.py
Addition: 13 Division: 3.333... Power: 1000

Interactive Visualization

python
Loading...
Output
Run execution to see output...