Latest Posts

See what's new

What Math is Required for Machine Learning?

You are probably here because you are thinking about entering the exciting field of machine learning. But on your road to mastery, you see a big roadblock that scares you. It is called math. Perhaps your last math class was in high school and you are from a non-technical background. Perhaps you have worked

Python Collections Module

In this post, we will introduce the collection module in Python, which provides a range of container types for object storage. We introduce the concept of a container in Python and then we go through the available container types. What is a Container in Python? Containers in Python are meta-objects that can hold an

Priority Queue and Heapq in Python

In this post we learn how to create priority queues using Python. There are 3 main ways to implement and use a priority queue in Python: Create a list and keep it manually sorted Use a binary heap on the basis of Python’s heapq module Use the priority queue implementation from Python’s Queue package

The Queue in Python

In this post, we learn how to implement a queue in Python using Python’s list data structure, the collections module, and a custom wrapper class What is a Queue in Python? A queue is a data structure that is based on the first-in, first-out principle when adding and removing items. Elements are added to

The Stack in Python

In this post, we will discuss how to implement the stack, a common data structure, in Python. To build the stack we are going to rely on Python’s built-in list data structure and the collections package. What is a Stack in Python? A stack is a data structure that is based on the last-in,

Matrix and Array in Python NumPy

In this post, we discuss single- and multidimensional arrays and matrices in Python. Since Python does not offer in-built support for arrays, we use NumPy, Python’s library for matrix and array computations. The NumPy array is one of the most versatile data structures in Python and it is the foundation of most Python-based data

Dictionaries, Tuples, and Sets in Python

In this post, we introduce three foundational data structures in Python: the dictionary, the tuple, and the set. What is a Dictionary in Python? A dictionary is a data structure that stores items using key-value pairs. Each entry needs to have a unique key. Entries are ordered and can be changed. Dictionaries come inbuilt

The List in Python

In this post we introduce Python lists and operations you can perform on lists in Python. What is a List in Python? The Python list is the most basic built-in data type that enables you to store sequences of items in a single variable. For example, we can create a list of letters ‘a’,

What is Encapsulation: An Introduction with Examples in Java and Python

In this post, we are going to introduce the concept of encapsulation in object-oriented programming. We will first look at encapsulation in Java followed by encapsulation in Python. If you are only interested in how to implement encapsulation in one of those languages, feel free to skip to the relevant section. What is Encapsulation?

Abstraction in OOPS: An Introduction With Examples in Java and Python

In this post we will develop an understanding of abstraction in object oriented programming and learn how to apply abstraction in Java and Python. What is Abstraction (in Computer Science)? Abstraction in everyday language refers to the practice of removing concrete details and dealing only with ideas that are relevant to the problem at