Graph Algorithms: Prim’s Algorithm in Python

Minimum Spanning Tree (MST) algorithms find the shortest path that connects all the points in a graph. Tree algorithms that find minimum spanning trees are useful in network design, taxonomies, or cluster analysis. On PythonAlgos, we’ve already covered one MST algorithm, Kruskal’s algorithm. Prim’s algorithm is similar to Kruskal’s algorithm. Whereas Kruskal’s adds to theContinue reading “Graph Algorithms: Prim’s Algorithm in Python”

Nested Lists in Python

Nested lists are Python representations of two dimensional arrays. They are used to represent lists of lists. For example, a list of grocery lists for the month or matrices we can multiply. In this post we’re going to go over how to use Python to create and manipulate nested lists. We’ll go over: Python NestedContinue reading “Nested Lists in Python”

Level 1 Python: Pure Python Matrix Multiplication

Level 1 Python projects are projects that are more logically complex or require more libraries than the ones in the Super Simple Python series. Pure Python matrix multiplication is one of the projects that is more logically complex, we won’t be using any external libraries here. Most of these projects should take you between 30Continue reading “Level 1 Python: Pure Python Matrix Multiplication”

List Directories, Files, and Subdirectories with Python

Creating, updating, and interacting with files is an integral part of data pipelines. In order to interactively access files, we have to be able to list them. There are three ways to list the files in a directory for Python. In this post we’ll cover how to use the os module and three of itsContinue reading “List Directories, Files, and Subdirectories with Python”

An Overview of Multiprocessing in Python

Python is one of the most popular programming languages today. However, one big weakness is that Python has no real parallelization capabilities. Multiprocessing is a way to implement virtual parallelization with Python. In this post we’ll cover: What is Multiprocessing? The Python Multiprocessing Library Running two Functions in parallel Multiprocessing Functions with Arguments Multiprocessing forContinue reading “An Overview of Multiprocessing in Python”

Python Multiprocessing Functions with Dependencies

Python multiprocessing is used for virtually running programs in parallel. We can use multiprocessing to simply run functions in parallel and run functions that need arguments in parallel. Sometimes, we also need to be able to access the values generated or changed by the functions we run. In this post we’re going to cover howContinue reading “Python Multiprocessing Functions with Dependencies”

Download any YouTube Video with Python

Over 100,000 people search for ways to download YouTube videos every month. Here’s how you can download a YouTube video with Python, for free. In this post we’re going to cover how to use the youtube_dl library to download YouTube videos with Python. We’re going to first learn about what the youtube_dl library is, andContinue reading “Download any YouTube Video with Python”

Combine Files that Start with the Same Words with Python

Recently I had to combine a bunch of files that started with the same prefix. I did an NLP analysis of a YouTube series where I had to split up my API calls for each episode. After getting the partial analysis results, I wanted to combine them into one file for each episode. This isContinue reading “Combine Files that Start with the Same Words with Python”

Private Variables in Python

There are three variable scopes you need to know. There are global variables, public variables, and private variables. Global variables can be accessed from all functions and modules in a program. Ideally they are only declared once in a whole program. Public variables belong to certain classes, but are visible to other classes, functions, andContinue reading “Private Variables in Python”

_ and __ Variables in Python

I recently received a question from someone in the Social Techies Discord channel, our tech community, about why some of my variables have “_” in front of them. This is not the first time I’ve been asked this, and when I started Python, I was curious myself. Some variables have underscores in front of them,Continue reading “_ and __ Variables in Python”

%d bloggers like this: