Know About Python Data Types | Understanding of Python Data Types

author
1 minute, 42 seconds Read
Home » Tech Learning » Python » Know About Python Data Types | Understanding of Python Data Types

What is Data Type?

In any Computer programming language, data type plays a major role. We can define datatype as “it is an attribute of data which Inform to the compiler or interpreter how the programmer/coder want to use those data”. Most of the programming languages have basic data types. In the same way, python also has basic data types.

  1. Numeric type:
  2. Sequence type:
  3. Set types:
  4. Mapping type:
  5. Boolean type:

Definition of Python Data Types

Numeric type:

It is used to store numeric values/Numbers. It contains 3 other types of data:

  1. Integer: Basically used to store number data and it can be positive and negative numbers for example 1, 2,45,67, 97, -8,-11,-87, etc.

2. Float: The numeric value which contains decimal values for example: 2.1, 4.786e2, 98.256, 7.987, etc.

3. Complex: Complex number represents real and imaginary value like Y+iZ where “Y” is a real number and “Z” is an imaginary number. For example 2+3i, 4+9i, etc.


Sequence type:

Sequence is a collection of similar or different data types which include 3 more types as follows :

  1. String: String is a collection of characters which can be reprensted in single quotes (‘ ‘), Double quotes (” “) and triple quotes(“”” “””) .

2. List: List is an ordered collection of same or different datatype and represented in square bracket [, , ,] and data insider square bracket separated by comma(,).

3. Tuple: It is also an ordered collection of the same or different datatype and represented in parenthesis ().


Set type:

Set is a collection of unordered data type which is mutable (means that it can be modifiable after creation).


Mapping type:

Dictionary: It is an unordered collection of data in a key: value pair form. Collection of such pairs enclosed in curly braces. for example {1: “Tom”, 2: “Bob”}.


Boolean type:

It is data with two built-in values i.e. “True” or “False” which can be also represented as “T” or “F” and it stores the comparison result which can be either “T” or “F”.



If you found this article useful please provide your valuable feedback in the below comment box EduTaxTuber!

Similar Posts

Leave a Reply