Skip to main content
Practice

Expressions and Arithmetic

In data analysis, you often calculate totals, differences, averages, and other metrics.

Python handles this through expressions — pieces of code that evaluate to a result.


What Is an Expression?

An expression is any combination of values, variables, and operators that Python can evaluate to produce a result.

Some examples:

  • 42 - a literal number
  • 5 + 3 - an addition expression
  • price * quantity - a multiplication using variables

If Python can run the statement and return a value, it’s considered an expression.


Arithmetic in Data Analysis

Data analysts use arithmetic operations to:

  • Add or combine values (e.g., total sales)
  • Calculate growth rates, margins, or discounts
  • Find averages and measure differences

Learning to build expressions is the foundation for processing and analyzing real-world data.


What You'll Practice

In the code block on the right, you’ll:

  • Add and multiply numbers
  • Work with variables
  • Build expressions to calculate meaningful results

Run the examples and experiment by changing the values to observe how the output changes.

Want to learn more?

Join CodeFriends Plus membership or enroll in a course to start your journey.