BeginnerCoder

Lesson 1 — Data as numbers

Machine learning starts with numbers

Machine learning (ML) means a program learns patterns from examples instead of following rules you typed by hand. A dataset is simply a list of those examples, and each measured value (a height, a price, a temperature) is called a feature. The very first thing anyone does with new data is summarise it — and the most common summary is the average (also called the mean): add everything up and divide by how many values there are.

data = [1, 2, 3]
print(sum(data) / len(data))   # 2.0

Why it matters: every ML model in this course is just arithmetic on lists of numbers like this one. If you can sum and divide a list, you can follow the rest.

Want it another way?
Task

Replace the 0 so avg is the mean of data. The program should print: average: 5.0

Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.

Next →
Test your knowledge

A quick 3-question quiz on this lesson — instant feedback.

Enjoying this lesson? Share it.