Python Question: Download Python PDF

When do you use list vs. tuple vs. dictionary vs. set?

Tweet Share WhatsApp

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 PDF Read All 25 Python Questions
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?