Zigask – Domande & risposte
Caricamento in corso…

Technology › Programming

What is the difference between a list and a tuple in Python?

Answers (1)

A list is mutable: you can add, remove and change items after creating it. A tuple is immutable, so it cannot change once created, which makes it safe to use as a dictionary key and slightly faster. Use a tuple for fixed collections of values, and a list when the content will change.

Versione beta · se trovi un errore, segnalacelo da «Assistenza e contatti»