AI Launch Lab
Sign in FR Get updates

AI foundations · Lesson 1 of 3

Data is a list of examples

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.

Your turn

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.

Loading Python (about 12 MB, once)…

    Checks

    • ○ average of [2, 4, 6] is 4
    • ○ average works with decimals
    • ○ above keeps values over the average, in order
    • ○ above of identical values is empty

    Output

    All courses