Python Data Structures Tutorial
Welcome to the Python Data Structures Tutorial. This website provides a comprehensive guide to understanding various data structures in Python.
What is Data Structure?
Organizing, managing and storing data is important as it enables easier access and efficient modifications.
Data structures allow you to organize your data in such a way that enables you to store collections of data, relate them and perform operations on them accordingly.
(Fig. Types of data structures)
Python has implicit support for data structures which enables you to store & access data.
Built-in Data Structures
Lists
Lists are used to store data of different data types in a sequential manner and there are addresses assigned to every element, called index.
Learn MoreTuples
Tuples are same as lists are with the exception that the data once entered into the tuple cannot be changed no matter what.
Learn MoreDictionaries
Dictionaries are used to store key-value pairs. Key-value pair is like phone numbers with contact name simply.
Learn MoreSets
Sets are the collection of unordered elements that are unique. If the data is repeated more than one time, it would be entered into the set only once.
Learn MoreUser-defined Data Structures
Python also allows you to create your own data structures using classes and objects. Some common user-defined data structures include:
- Stack: A linear data structure that follows the LIFO (Last In First Out) principle.
- Queue: A linear data structure that follows the FIFO (First In First Out) principle.
- Tree: A hierarchical data structure with a root value and subtrees of children.
- Graph: A non-linear data structure consisting of nodes and edges.
- HashMap: An implementation of a hash table data structure.