Data Types - Ryzen Hunt

Data Types
Data types represent the types of data inside a variable. Python supports various types of data. Here we have explained basic data types used in python.
Note: type() is used to determine the type of data type.
Numeric
Integers, floating point numbers, and complex numbers fall under Python numeric category. They are defined as int, float, and complex class in Python. Integers can be of any length; it is only limited by the memory available. A floating point number is accurate up to 15 decimal places. Complex numbers are written in the form, x + yj, where x is the real part and y is the imaginary part.

Text type
Strings fall in this data type. Strings represent a sequence of characters.

Sequence Type
In Python, a sequence is the ordered collection of data types. Sequences allow storing multiple values in an organized and efficient manner. List and tuple fall in sequence type in python.
Lists are similar to arrays and may contain
Data Types like Integers, Strings, as well as Objects.
Lists are mutable, and hence, they can be altered even after their creation. The elements in a list are indexed according to a definite sequence and the indexing of a list is done with 0 being the first index. Elements of the list are surrounded by square brackets.

The tuple is similar to list, but tuple is immutable and its elements are surrounded with parenthesis.

Mapping Type
Dictionary falls under this data type which contains keys mapped by their values.

Set Type
Set and Frozenset fall under this data type. Set is an unordered collection of data type that is iterable, mutable, and has no duplicate elements.

Frozenset is similar to set except it is immutable.

Boolean Type
The only allowed values for this data type are: True and False.
Internally Python represents True as 1 and False as 0

Binary Type
Bytes and Bytearray fall under Binary data type. Byte data type represents a group of byte numbers just like an array within range of 0 - 255. Bytearray is exactly the same as bytes data type except that its elements can be modified.
None
None is another special data type in Python. None is frequently used to represent the absence of a value.

Hope you learned something new today. Please share with your friends and Don't forget to share your valuable Suggestions and Feedback with us.
For visiting our Python Course series click here.
Suggested Product:
McAfee AntiVirus Plus is a smart next gen security for your computer that detects and blocks viruses and malware. It protects everything on your PC and keeps it safe from viruses, spyware, and Trojans.Click here or click on the image to buy this at a special price.