Python Built-in Primitive Data Types

Q

What Are Python Built-in Primitive Data Types?

✍: FYIcenter.com

A

Python Built-in Primitive Data Types are data types provided by the Python interpreter to represent individual data values.

Here is a list of Python Built-in Primitive Data Types:

  • "NoneType" - A special data type represents a single value of nothing, which can be expressed as "None".
  • "bool" - The Boolean data type for Boolean true and false values, which can be expressed as "True" and "False".
  • "int" - The integer data type for signed integers unlimited magnitude. "int" and "long" are combined to "int" data type since Python 3. "int" values can be expressed using the standard signed integer expressions like: 1234, -1234, 0, etc.
  • "float" - The real number data type for any real numbers with system-defined precisions. "float" values can be expressed using scientific notations like: 3.1415927, -2.14, 2.99792458E8, etc.

You can use the type() function to see the data type of a given primitive value expression.

C:\fyicenter>python
Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:14:34) [MSC v.1900 32 bit (Intel)]
 on win32
Type "help", "copyright", "credits" or "license" for more information.

>>> type(None)
<class 'NoneType'>
>>> type(True)
<class 'bool'>
>>> type(1234)
<class 'int'>
>>> type(3.14159)
<class 'float'>

 

'int' Literals and Conversions

Using Python Built-in Data Types

Using Python Built-in Data Types

⇑⇑ Python Tutorials

2023-01-06, 2427🔥, 0💬