List
- A
List
is a dynamic array in Python, allowing you to store multiple different values, and elements can be changed after initialization. - To declare a
List
, use square brackets[]
.
Example:
Tuple
- A
Tuple
is an immutable data structure in Python, often used to protect data from being changed after initialization. - To declare a
Tuple
, use parentheses()
.
Example:
Set
- A
Set
is a data structure that does not contain duplicate elements and has no order. - To declare a
Set
, use curly braces{}
or theset()
function.
Example:
Dictionary
- A
Dictionary
is an unordered data structure that stores information in key-value pairs. - To declare a
Dictionary
, use curly braces{}
and separate each key-value pair with a colon:
.
Example:
These data structures allow programmers to manipulate and process data flexibly in Python, suitable for various programming scenarios and purposes.