Get Started

Calculations with variables

You've now created a savings variable, so let's start saving!

Instead of calculating with the actual values, you can use variables instead.

How much money would you have saved four months from now, if you saved $10 each month?

This is a part of the course

“Introduction to Python”

View Course

Exercise instructions

  • Create a variable monthly_savings, equal to 10 and num_months, equal to 4.
  • Multiply monthly_savings by num_months and assign it to new_savings.
  • Print the value of new_savings.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create the variables monthly_savings and num_months



# Multiply monthly_savings and num_months
new_savings = ____

# Print new_savings

This exercise is part of the course

Introduction to Python

BeginnerSkill Level
4.8+
2411 reviews

Master the basics of data analysis with Python in just four hours. This online course will introduce the Python interface and explore popular packages.

An introduction to the basic concepts of Python. Learn how to use Python interactively and by using a script. Create your first variables and acquaint yourself with Python's basic data types.

Exercise 1: Hello Python!Exercise 2: Your first Python codeExercise 3: Python as a calculatorExercise 4: Variables and TypesExercise 5: Variable AssignmentExercise 6: Calculations with variables
Exercise 7: Other variable typesExercise 8: Operations with other types

What is DataCamp?

Learn the data skills you need online at your own pace—from non-coding essentials to data science and machine learning.

Start Learning for Free