Lesson 2.4: Data Structures in Python (List, Tuple, Set, Dictionary)
Python has built-in data structures to store and manage collections of data.
1. List
-
Ordered, changeable, allows duplicates.
-
Defined with
[]
2. Tuple
-
Ordered, unchangeable, allows duplicates.
-
Defined with
()
3. Set
-
Unordered, no duplicates.
-
Defined with
{}
4. Dictionary
-
Key-Value pairs, unordered, changeable.
-
Defined with
{key: value}
✅ In Summary:
-
List → Ordered, changeable, duplicates allowed.
-
Tuple → Ordered, unchangeable.
-
Set → Unordered, no duplicates.
-
Dictionary → Key-Value pairs, flexible.
