Python Question:
Download Questions 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.

Download Python Interview Questions And Answers PDF

Previous QuestionNext 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?