Perform mathematical operations on numeric data in Python

Beginner
Developer
Visual Studio

Convert user input to numeric values, and use mathematical operators to perform calculations.

Learning objectives

In this module, you will:

  • Use the type(), isinstance(), and isnumeric() methods to inspect a value's data type and its suitability for use or conversion to a numeric data type.
  • Use mathematical operators to perform basic mathematical operations on numeric data.
  • Use the float data type to represent values that include fractional values represented by numbers after the decimal point.

Prerequisites

  • A Python development environment, already set up.
  • Knowledge of how to create, edit, and execute Python code that's stored in a .py file.
  • Exposure to the use of input and output functions, such as print() and input().
  • Knowledge of how to create and use variables, and how to perform basic operations on strings, such as concatenation.
  • Some exposure to data type conversion functions, such as int() and str().