{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/02_Python_Datatypes)**\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Python Numbers, Type Conversion and Mathematics\n",
"\n",
"In this class, you'll learn about the different numbers used in Python, how to convert from one data type to the other, and the mathematical operations supported in Python."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Number Data Type in Python\n",
"\n",
"Integers, floating point numbers and complex numbers fall under Python numbers category. They are defined as **`int`**, **`float`** and **`complex`** classes in Python.\n",
"\n",
"Integers and floating points are separated by the presence or absence of a decimal point. For instance, 5 is an integer whereas 5.0 is a floating-point number.\n",
"\n",
"Complex numbers are written in the form, `x + yj`, where `x` is the real part and `y` is the imaginary part.\n",
"\n",
"We can use the **[type()](https://github.com/milaan9/04_Python_Functions/blob/main/002_Python_Functions_Built_in/064_Python_type%28%29.ipynb)** function to know which class a variable or a value belongs to. Similarly, the **[isinstance()](https://github.com/milaan9/04_Python_Functions/blob/main/002_Python_Functions_Built_in/034_Python_isinstance%28%29.ipynb)** function is used to check if an object belongs to a particular class.\n",
"\n",
"Let's look at an example:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2021-06-09T13:39:54.836631Z",
"start_time": "2021-06-09T13:39:54.814237Z"
},
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"