
![]() |
@wtf | |
Here is Data Structures |
||
2
Replies
41
Views
2 Bookmarks
|
![]() |
@wtf | 8 August 25 |
1. List (Ordered & Mutable) - Stores mixed data types - Supports indexing and slicing - Common methods: append(), remove(), pop(), sort() python my_list = [1, 2, 3, apple] my_list.append ![]() print(my_list[2]) Output: 3 2. Tuple (Ordered & Immutable) - Cannot be changed after creation - Great for fixed collections python my_tuple = (10, 20, 30) print(my_tuple[1]) Output: 20 3. Dictionary (Key-Value Pairs) - Keys are unique - Fast for lookups - Mutable and dynamic python student = name: Amit, age: 21 print(student[name]) Output: Amit student[age] = 22 4. Set (Unordered & Unique) - No duplicates allowed - Useful for set operations: union, intersection python nums = 1, 2, 3, 2 print(nums) Output: 1, 2, 3 nums.add(4) Use: - List: Ordered collections - Tuple: Fixed values - Dict: Mapping data - Set: Unique elements |
||
![]() |
@robotemperor | 21 days |
(Bitten) tis re all confusing, I learn better by practice
|
||


