What are Python's built-in data types?

Python offers a variety of built-in data types to represent different kinds of data. Here's a breakdown:

Numeric Types
int: Represents integer numbers (e.g., 10, -5, 0)
float: Represents floating-point numbers (e.g., 3.14, 2.5)
complex: Represents complex numbers (e.g., 2+3j) Python Training in Mumbai
Text Type
str: Represents sequences of characters (e.g., «Hello, world!»)
Sequence Types
list: Ordered and mutable collection of items (e.g., [1, 2, 3, «apple»])
tuple: Ordered and immutable collection of items (e.g., (1, 2, 3))
range: Represents an immutable sequence of numbers (e.g., range(5))
Mapping Type
dict: Unordered collection of key-value pairs (e.g., {'name': 'Alice', 'age': 30})
Set Types
set: Unordered collection of unique elements (e.g., {1, 2, 3})
frozenset: Immutable version of set (e.g., frozenset({1, 2, 3}))
Boolean Type
bool: Represents truth values (True or False) Python Course in Mumbai
Binary Types
bytes: Immutable sequence of bytes
bytearray: Mutable sequence of bytes
memoryview: Object providing a view of the memory of an existing object
Special Type
NoneType: Represents the absence of a value (None)

Нет комментариев