There are several built-in data types in Python. Although, Python doesn't require data types to be defined explicitly during variable declarations but type errors are likely to occur if the knowledge of data types and their compatibility with each other are neglected. Python provides type()
and isinstance()
functions to check the type of these variables. These data types can be grouped into the following catetgories-
- None Type
None
keyword represents the null values in Python. Boolean equality operation can be performed using these NoneType objects.
Class Name |
Description |
NoneType |
Represents the NULL values in Python |
- Numeric Types
There are three distint numeric types - integers, floating-point numbers, and complex numbers. Additionally, booleans are a sub-type of integers.
Class Name |
Description |
int |
Stores integer literals including hex, octal and binary numbers as integers |
float |
Stores literals containing decimal values and/or exponent sign as floating-point numbers |
<tr style="-webkit-font-smoothing:subpixel-antialiased; background-color:#d7f4de; border:0px; box-sizing:border-box; font-family:Helvetica,Arial,sans-serif; margin:0px; padding:0px; text-rendering:optimizelegibility; vertical-a