Skip to content

Python for Data: First Steps

Programming Python Difficulty 1/5

Beginning of the lesson

Python for Data: First Steps

Turn a list of numbers into real answers

Big Idea: A list can hold lots of numbers, and that collection of numbers is called data. Python gives you tiny, ready-made tools to ask big questions about data: "What is the total?", "What is the average?", "What is the biggest?", "What is the smallest?" This is the very first step toward data science — using code to understand numbers.
By the end you will be able to:
  • store data as a list of numbers,
  • use sum() and len() to get a total and a count,
  • calculate an average, and find the max() and min().

1. Numbers in a list are "data"

You already know a list can hold many values inside square brackets. When those values are numbers we can measure, we call the whole collection data. It could be test scores, daily temperatures, the heights of your friends, or points in a game.

Here is a small list of quiz scores. We can print the whole list, and use len() to count how many scores there are:

scores = [8, 5, 10, 7]
print(scores)
print(len(scores))

Expected output:

[8, 5, 10, 7]
4

len(scores) does not add the numbers — it counts the items. There are four scores, so it prints 4.

2. Data goes in, answers come out

Working with data follows a friendly pattern: your numbers go in, Python's tools process them, and useful answers come out. Think of it like a juicer: you put in fruit, turn the handle, and out comes juice.

[8, 5, 10, 7] your data sum() len() max() min() process it 30, 4, 10, 5 answers
A list of numbers goes in, Python's built-in tools process it, and answers about the data come out.

The three little tools we turn the handle with are sum(), len(), max(), and min(). Let us meet them one by one.

Continue this lesson on YourAIZone

The full lesson has the complete explanation, worked examples, common mistakes, tests with instant checking and an AI tutor. Start right away as a guest, or create an account to keep your progress.

In the full lesson

  • The complete explanation
  • Worked examples
  • Common mistakes and how to avoid them
  • Test questions: 15
  • AI tutor that answers questions about the topic
  • Progress tracking for students, parents and teachers