When should you use a list instead of a tuple?
Reveal the answer and explore the explanation.
01EasyCoreWhen should you use a list instead of a tuple?
Answer
EasyCore
When should you use a list instead of a tuple?
Answer
Mutable ordered collection supporting indexing and duplicates.
Practical example
Append a new training example without recreating the collection.
PythonRelated concept example
from collections import Counter
words = ['ai', 'ml', 'ai']
counts = Counter(words)
print(counts['ai']) # 2Counter is a dictionary-like frequency collection.
Reference: Further reading ↗