Lists 🆚 Tuples 🆚 Dictionaries
What's the difference?
Lists are mutable.
Tuples are immutable.
Dictionaries are associative.
When should you use each?
Lists:
⟶ When you want to add or remove elements
⟶ When you want to sort elements
⟶ When you want to slice elements
Tuples:
⟶ When you want a constant object
⟶ When you want to send multiple in a function
⟶ When you want to return multiple from a function
Dictionaries:
⟶ When you want to map keys to values
⟶ When you want to loop over the keys
⟶ When you want to validate if key exists
Now, pick your weapon of mass data analysis and become a Python pro!
Python Interview Q&A: https://topmate.io/coding/898340
Like for more ❤️
ENJOY LEARNING 👍👍
Post #933
1.99K
- ❤ 5