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 ▸

Write a function that takes a list of numbers as input, and outputs the average of the numbers. The function should catch any errors.


Print "Hello World!" ten times without typing (or pasting) the print function more than once


how to compute the factorial of a number.


Write a recursive function that takes any integer n and prints the nth Fibonacci number.