AI foundations · Lesson 1 of 3
AI foundations · Lesson 1 of 3
Most AI starts with something plain: examples written down. A store’s daily sales, the time each delivery took, the number of calls per hour. In Python, a simple way to hold them is a list: sales = [120, 95, 143, 110].
Before any model, people who work with data look at a few summary numbers. The most common is the average (mean): add everything up, divide by how many there are. sum(sales) adds a list and len(sales) counts it.
Comparing each example to the average is often the first useful finding: which days were unusually busy, which deliveries were slow.
Write average(xs), which returns the mean of a list, and above(xs), which returns the values greater than the average, in their original order.
All checks pass. Well done.
Next lesson: A first predictionAn AI tutor that gives hints, not answers. It sees your code, its output and this lesson. It can be wrong.