Python for Lifetime
BASIC DATA STRUCTURE CONCEPTS
Major Python Data Structures
- Lists
2. Tuples
3. Dictionaries
4. Sets
- Lists
List can contain values of any type as a sequence. Arrays are usually implemented in python using Lists.
A single list can contain String, integer, float at once.
Lists are mutable. Meaning, elements can be inserted, deleted or modified.
2. Tuples
Tuples are immutable. Once created, insert, delete or modify operations cannot be done on tuple elements.
Immutability makes it useful while passing arguments to the function parameters in python ie., to *args.
3. Dictionaries
Dictionary stores key-value pairs. Values could be of different data types and even contain duplicates but the key should be unique and of string data type.
Dictionary can be used to implement Hash maps.
4. Sets
Sets is unordered and immutable. It can store elements of different data types at once. Once created, a set can be modified.
Sets are usually used where mathematical set operations such as union or intersections are to be used on the data.
Coming up next : Python for Lifetime — LIST.
Thank for your patience.