Python Keywords, Identifiers and Statements 8

Data types in Python

Data types are the classification or categorization of data items. Data types represent a kind of value which determines what operations can be performed on that data.
Numeric, non-numeric and Boolean (true/false) data are the most used data types. However, each programming language has its own classification largely reflecting its programming philosophy.

Python provides various standard data types that define the storage method on each of them. The data types defined in Python are given below.

Numbers
Sequence Type
Boolean
Set
Dictionary

 

Python Numbers

Integers, floating-point numbers, and complex numbers fall under the Python numbers category. They are defined as int, float, and complex class in Python. There are three numeric types in Python:

Integer number (int)
Floating-point number (float)
Complex numbers (complex)

Variables of numeric types are created when you assign a value to them:

type() function
We can use the type() function to know which class a variable or a value belongs to.

isinstance() function
isinstance() function is to check an object belongs to which particular class.

Visitor Counter

0056738