Level 1
0 / 100 XP

What is an integer?

A program that can't work with numbers isn't very useful. Counters, scores, ages, years, quantities — almost every real program tracks at least one of these.

In Python, whole numbers are called integers.

What counts as an integer

Integers are numbers with no decimal point. They can be positive, negative, or zero:

Python
score = 100 year = 2025 temperature = -7 lives = 0 print(score) print(year) print(temperature) print(lives)

That's it. No special syntax, no extra steps — just assign and go.

Integers are exact

Python stores integers exactly as they are. There's no rounding, no approximation, no hidden decimal point. 42 is always 42.

Python
a = 1000000 b = 999999 print(a - b) # always exactly 1

This matters more than it sounds — not all programming languages guarantee this.

Key takeaways

  • An integer is any whole number — positive, negative, or zero
  • There is no size limit on integers in Python — they can be as large as your memory allows
  • Integers are stored exactly — no rounding ever happens