AlgoDaily

Introduction to Numbers and Counting

Read at your own pace. Code execution, quizzes, progress tracking, and the AI tutor are available in the interactive view with JavaScript enabled.

Welcome, Number Explorer

Why this lesson matters

Welcome to the first tiny-but-mighty brick in our math journey for data science, AI, and machine learning.

Before a computer can learn, predict, sort, or compare, it needs numbers. Numbers help us answer questions like:

  • How many people clicked a button?
  • How many pixels are in a picture?
  • How many times did a word appear?
  • Which value is bigger or smaller?

In this lesson, we start like a 5-year-old scientist: by learning what numbers are and how counting works. Later, we will use these same ideas for shapes, patterns, statistics, probability, and algorithms.

Welcome, Number Explorer

Numbers Name Amounts

What is a number?

A number tells us how many things there are.

If you have:

🍎  🍎  🍎

You can say: there are 3 apples.

The word three and the symbol 3 both point to the same idea: the amount.

Number vs numeral
  • The number is the idea: “how many?”
  • The numeral is the written symbol: 3

Like your name points to you, the symbol 3 points to the amount three.

Numbers Name Amounts

Counting Has Rules

Counting is not just saying words

Counting means matching each object with exactly one counting word.

Toy:      🧸   🚗   🧩   ⚽
Count:     1    2    3    4

Three important counting rules:

  1. Use the number words in order: 1, 2, 3, 4, 5...
  2. Touch or point to each thing once: no skipping, no counting twice.
  3. The last number tells the total: if you stop at 4, there are 4 things.

This is a big idea in data science too: if we count badly, our data becomes wrong.

Counting Has Rules

Count The Stars

How many stars are here?

⭐  ⭐  ⭐  ⭐

Python Counts Too

Computers can count with us

Python can help us count objects stored in a list.

A list is like a little row of things. We will study data structures more later, but for now, think of it as a basket holding items.

In this example:

  • enumerate(..., start=1) gives each toy a counting number.
  • len(toys) tells how many toys are in the list.
```python
toys = ["bear", "car", "block", "ball"]

print("Let's count the toys!")

for number, toy in enumerate(toys, start=1):
    print(number, toy)

print("Total toys:", len(toys))
```

Same Group, Same Count

True or false?

If two people count the same group of objects and both people count every object exactly once, they should get the same total.

Zero Means None

Meet the number 0

Zero means: there are no things to count.

Basket:  empty
Count:   0 apples

Zero is not useless. It is one of the most important numbers in computing.

For example:

  • 0 apples means no apples.
  • 0 clicks means nobody clicked yet.
  • An empty Python list has length 0.

In data work, zero often tells an important story: something did not happen, something is missing, or there are none of a thing.

```python
apples = []
clicks_today = 0

print("Number of apples:", len(apples))
print("Clicks today:", clicks_today)

if len(apples) == 0:
    print("The basket is empty.")
```

Nothing To Count

A basket has no bananas in it.

What number tells how many bananas are in the basket?

Fill in the blank: _____________

Numbers In Order

Numbers line up like stepping stones

Counting numbers come in an order:

0 ── 1 ── 2 ── 3 ── 4 ── 5 ── 6

When we move to the right, the numbers get bigger.

So:

  • 1 is smaller than 4
  • 5 is bigger than 2
  • 3 comes after 2

This order helps computers compare values. For example, a program can decide whether one count is bigger than another count.

Numbers In Order

Your Data Journey Begins

What you learned

You just learned the first language of data: numbers and counting.

You now know that:

  • Numbers tell how many.
  • Counting means matching each object to one number word.
  • The last counting number is the total.
  • 0 means none.
  • Numbers have an order, so we can compare them.
  • Python can count items using tools like len().

This is the beginning of thinking like a data scientist. Next, we will look at Shapes and Patterns, where we notice what things look like and how they repeat.

Your Data Journey Begins

Open interactive view →