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 #2599
1.68K
- โค 3
- ๐ 1