Lecture

Everyday Examples of Data Usage

Data analysis is no longer a skill reserved for companies. It now powers many services we use daily—often working silently in the background.

For example, the following services rely heavily on data analysis:

  • Streaming apps recommending content you might like
  • Online shopping platforms offering personalized product suggestions
  • Banks monitoring transactions to detect fraud

In this lesson, you’ll use Python to practice one of the most fundamental data analysis tasks with a short hands-on example.


Python Warm-up: Calculating the Average

One of the most common concepts in data analysis is the average — a simple metric that represents the central tendency of a dataset and helps summarize information efficiently.

For example, let's calculate the average daily sales amount using price data from items sold over a week.

The formula for calculating the average is straightforward:

Average = Total sum of data ÷ Number of data points

In Python, you can easily implement this calculation using the built-in functions sum() and len():

Python: Calculating Average Daily Sales
# Weekly sales data retrieved from an internal database sales_data = [8120, 9200, 7890, 10230, 8675, 9340, 10000] # Calculate total sales total_sales = sum(sales_data) # Divide by the number of days to get the average average_sales = total_sales / len(sales_data) # Print the result print("Average daily sales:", int(average_sales))

Checking the Result

Run the code on the right to check the result.

For small datasets, you can easily calculate the average using sum() and len(). However, when working with tens of thousands or even millions of data points, it's more efficient to use libraries like NumPy or Pandas for faster computations.

You’ll learn how to use NumPy and Pandas for these calculations later in the course.

Quiz
0 / 1

Which Python function is used to calculate the total of all values in a list?

In Python, the function is used to add up all the values in a list.
agg
add
median
sum

Lecture

AI Tutor

Design

Upload

Notes

Favorites

Help

Code Editor

Run
Generate

Execution Result