How Many Data Types in Python | Data Types in Python 3


Python Data Types:-

Python also supports different primitive data types like other programming languages. Data types in Python tell us which operations are performed on data. In python data are nothings but basically class. And variables are the instance of the class in python. There are Different Data Types:-

  • 1. Integer(Number)
  • 2. Float
  • 3. Complex
  • 4. Boolean
  • 5. String
  • 6. List
  • 7. Tuple
  • 8. Dictionary

1. Integer(Number):-

It store numeric values. It can be positive or negative. Integer belongs to int Class.

They are also called Integer or int. Python2 has two types int and long. But python3 has only one data type int. There is no long data type.

Data Types in Python

2. Float:-

Float is used to store decimal values. We can use either positive or negative sign between e or E. Absence of these sign indicate the positive e. It belongs to float Class.

Data Types in Python

3. Complex:-

Complex data type stores the both real and imaginary parts of a number. Complex is a very useful data type in python. ‘j’ is written with the complex number. Other data-types are changed with each other. For example Integer and Float are changed with each other. But the complex can not be changed in other types. It belongs to complex Class.

Data Types in Python

4. Boolean:-

The boolean data type is used to store both True or False values. Boolean is very helpful to evaluate an expression in a program. It belongs to bool Class. It is a very helpful data type.

Data Types in Python

5. String:-

String is a sequence of characters. In a python, a string is represented using single or double-quotes. We can easily access substring using slicing. A string is an immutable data type, so programmers can not add or remove char from the string.

Data Types in Python

Multi-lines strings are represented using a triple quote. String belongs to str Class. Python does not support char data-type. One character string is also treated as char.

x = “””Ram is god boy
and intelligent
as well”””

print(‘data type is’,type(x))


Ram is god boy
and intelligent
as well
data type is

6. List:-

List is a collection of values of the different or same type. The list is a mutable data type, so we can easily change the values of a list. The item in the list is separated using comma(,). The list is enclosed in square brackets[]. It belongs to list Class. The list is accessed easily using indexing.

Data Types in Python

We can easily access the sublist using slicing. The list is a very useful data type. List support different method such as push(), pop(), sort(), reverse(), insert() and remove() etc. These methods are very useful. It is used to perform different operations on the list. These methods are very useful for programmers. The list is easily nested.

7. Tuple:-

A tuple is also used to store values of the different or same type. But the only difference is that it is an immutable data type. Tuple value can not be changed. Tuple values always remain the same. The comma (,) is used to separate the item in the tuple. A tuple is enclosed in circle brackets(). It belongs to tuple Class. We can easily access sub tuple using slicing.

Data Types in Python

8. Dictionary:-

Dictionary is used to store the data in key-value pairs. It is a mutable data type. In the dictionary, each key is mapped with its value. That is why it is also known as a mapping data type. Using built-in function dict() programmers also create the dictionary. It belongs to dict Class. Dictionary is enclosed in curly brackets{}. The keys and values are separated using a colon(:).

Data Types in Python
Leave A Reply

Your email address will not be published.