Super Simple Python: Reading and Writing to a Text File

Reading and writing to a text file are two of the most basic ways to import and export data with Python. In 2022, Python is strongly known for machine learning use cases. While text files are not traditionally thought of as ML data containers, they can often be the medium of inference. For example, IContinue reading “Super Simple Python: Reading and Writing to a Text File”

Dijkstra’s Algorithm in 5 Steps with Python

Dijkstra’s Algorithm is one of the most well-known graph algorithms. It is also one of the hardest to spell and pronounce. It’s pronounced “dike-struh” algorithm. Dijkstra’s algorithm is a shortest path algorithm with many variations. In this post we’ll be going over two Python implementations of Dijkstra’s algorithm. ‘ The first is the naive implementation,Continue reading “Dijkstra’s Algorithm in 5 Steps with Python”

295. Find Median from Data Stream LeetCode Solution

I don’t usually do LeetCode problems, but this one comes up as a real life use case for me so I wanted to share. This problem is about data streaming and handling data in real time. It’s similar to what we call ETL or ELT in industry. LeetCode 295. Find Median from Data Stream ProblemContinue reading “295. Find Median from Data Stream LeetCode Solution”

Super Simple Python: Simple Calculator

Super Simple Python is a series of Python projects you can do in under 15 minutes. In this episode, we’ll be covering how to build a simple calculator in under 30 lines of Python! For a video version: Unlike some of the Super Simple Python examples we’ve done, these don’t require any libraries!  Defining theContinue reading “Super Simple Python: Simple Calculator”

Prim’s Algorithm in Python for MST

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. This time we’re going to cover Prim’s algorithm for an MST. Prim’sContinue reading “Prim’s Algorithm in Python for MST”

Level 1 Python: Scientific Calculator

As part of the Super Simple Python series, we made a basic, four-function calculator. Since then, we’ve also covered how to do math in Python. From the math tutorial, we learned how we could use the Python math module to perform operations outside of the basic add, subtract, divide, and multiply.  Let’s use the mathContinue reading “Level 1 Python: Scientific Calculator”

Python Generators, Yield, and Yield From

Introduced in PEP 255, Generators are a special type of Python function that return lazy iterators. Python yield‘s generators. A lazy iterator is one that does not hold its contents in memory. This is especially useful when dealing with large amounts of data and for optimizing space complexity. They’re also useful for animations, as weContinue reading “Python Generators, Yield, and Yield From”

Create Your Own AI Content Moderator – Part 3

As content on the web increases, content moderation becomes more and more important to protect sensitive groups such as children and people who have suffered from trauma. We’re going to learn how to create your own AI content moderator using Python, Selenium, Beautiful Soup 4, and The Text API. Our AI content moderator will beContinue reading “Create Your Own AI Content Moderator – Part 3”

A Python Guide to the NY Times Movie Review Search

A while ago I wrote an article on How to Download Archived News Headlines using the NY Times API. In this post, we’re going to go over how to use the Movie Reviews API from the NY Times to pull movie review articles. The only non-native Python library you’ll need for this is the requestsContinue reading “A Python Guide to the NY Times Movie Review Search”

Super Simple Python: Generate a Deck of Cards

Super Simple Python is a series of Python projects you can do in under 15 minutes. In this episode, we’ll be covering how to generate a standard deck of cards in about 30 lines of code. For a video version see: Many of the Super Simple Python projects have revolved around random number generation orContinue reading “Super Simple Python: Generate a Deck of Cards”

%d bloggers like this: