Lists are a type of sequence data structure that can hold any type of data. They are mutable, which means you can change their content after they have been created. Lists are created by enclosing a sequence of elements in square brackets [ ] separated by commas. Here's an example:
my_list = [1, 2, "three", True]Tuples are similar to lists, but they are immutable, which means that you cannot change their content after they have been created. Tuples are created by enclosing a sequence of elements in parentheses ( ) separated by commas. Here's an example:
my_tuple = (1, 2, "three", True)Dictionaries are a type of data structure that stores data in key-value pairs. The keys must be unique and immutable, while the values can be of any type. Dictionaries are created by enclosing a sequence of key-value pairs in curly braces { } separated by commas. Here's an example:
my_dict = {"key1": "value1", "key2": 2, "key3": ["a", "b", "c"]}Sets are a type of data structure that stores a collection of unique elements. Sets are created by enclosing a sequence of elements in curly braces { } separated by commas. Here's an example:
my_set = {1, 2, "three", True}That's a quick overview of the four main data structures in Python!