What are the main data structures that I can use in Python

The main data structures in Python are tuples, lists, and dictionaries.

The main difference between them is that in tuples and lists the element order matters, while in dictionaries elements are associated to a given key. Plus, tuples are immutable, while lists and dictionaries are mutable, meaning that if you want to edit an element of a tuple, you have to create another tuple. Several are instead the operations that can be performed for list and dictionary manipulation.

LR

Related Python Mentoring answers

All answers ▸

Give a segment of python code that will print the numbers 1 to 7, each one on a new line


[Student query] Why do we import libraries/modules such as Numpy and Matplotlib into Python?


Sort a given input of lowercase letters alphabetically


Write a recursive function to return the nth Fibonacci number in Python