Python Question: Download Python PDF
When do you use list vs. tuple vs. dictionary vs. set?
Answer:
List and Tuple are both ordered containers. If you want an ordered container of constant elements use tuple as tuples are immutable objects.
Previous Question | Next Question |
When you need ordered container of things, which will be manipulated, use lists. | Do they know a tuple/list/dict when they see it? |