Introduction
Math will be a part of almost every project you create throughout your journey as a developer. If you're a data scientist, you might be making rather complex calculations. If you're creating websites, you might be determining pricing or items in a shopping cart. Python, like any other programming language, provides numerous operators and libraries for performing mathematic operations.
Scenario: Create a program to calculate the distance between planets
Imagine you're creating a program to calculate the distance between planets. The program enables a user to enter the distances of two planets from the sun, and calculates the distance between those two planets. Additionally, you want to provide the distance in both miles and kilometers.
What will you learn?
In this module, you'll explore the core mathematic capabilities of Python. You'll learn:
- The mathematic operators available in Python.
- The order of operations.
- How to convert strings to numbers.
What is the main objective?
Build on the power of math operators when you create a Python program.
Prerequisites
You should be familiar with the concept of programming.
You don't need to install Python to complete this module. You'll use an interactive sandbox to complete the exercises.
If you want to try out the code in the explanations, you might want to work through Get started with Python in Visual Studio Code first, if you haven't already. This module helps you prepare a Python environment.