Day 1 of #10dayofpythondatatypes – Numeric

Data types are an essential concept in the python programming language. In Python, every value has its own data type.

The classification of data items or to put the data value into some sort of data category is called Data Types. It helps to understand what kind of operations can be performed on a value.

In the Python Programming Language, everything is an object. Data types in Python represents the classes or strata of the said data.

The objects or instances of these classes are called variables. Variables is simply explained as how people use CR7 to refer to Christiano Ronaldo. CR7 there is the variable that holds the value ‘CHRISTIANO RONALDO’.

The listed below are different kinds of data types in Python. Today we will be looking at most use python Number (Numeric data).

Built-in Data Types in Python are as follow.

1. Python Numbers
2. Python List
3. Python Tuple
4. Python Strings
5. Python Set
6. Python Dictionary
7. Boolean Type

In Python, numeric data type represents the data which has numeric value. Numeric value can be integer, float number or even complex numbers. These values are defined as ” int, float and complex class in Python”.

Integers – This value is represented by int class. It contains positive or negative whole numbers (without fraction or decimal). In Python there is no limit to how long an integer value can be. e.g 45 or 575975463

Float – This value is represented by float class. It is a real number with floating point representation. it’s however a number, positive or negative, containing one or more decimals numbers. eg. 0.3

The character e or E followed by a positive or negative integer may be appended to specify scientific notation.

Complex Numbers – Complex number is represented by complex class. It is specified as (real part) + (imaginary part)j. For example – 2+3j

Complex numbers are written with a “j” as the imaginary part:

Note: type() function is used to easily determines the type of data use in python.

The picture above shows the usage of each numeric data type from integer, float and complex as shown in input. While the Output shows the data type of each input, with the usage of type () function.