If you’re interested in writing Python, then at some point you’ve probably wondered how to automate parts of your life, and have your script run automatically on its own.

In this article, I’m going to explain a simple python script to send emails, and how you can have that email sent automatically without ever having to touch the code again.

First, let’s write some code. In Python we’ll need to import a couple of libraries to make the magic work: smtplib for our email functionality. This will connect to our email server (in this case a Gmail account).

To easily…

Today, I want to talk about WordPress a content management service (CMS). CMS is an application used to manage and publish web content in a really simple user-friendly way. It allows marketers, content creators, and merchandisers to interact with the website without having to use the IT department. In a world where content is everything the ability to quickly make changes on a website is invaluable. It’s a quick way to get a site up with the basics. …

Recently I found myself in need of some open-source information. There are multiple ways to gather information on the web. You could use Selenium to scrape the web (although sites make that more difficult every year). One of the most effective ways is to use an API, and one of the best to use is Reddit's.

Reddit in itself already gathers all sorts of information from the web. The subreddits and topics are endless. It’s very much a one-stop-shop for any topic you want to research. I recently found myself in need of such information, and really appreciated Reddit's open-source…

At some point in your web development journey you’ll want full control of your website, and mastering the art of web hosting can bring you closer to that goal. If you’re reading this article I assume you’re comfortable looking at code, and using the linux terminal. I’ll be touching on the basics of setting up your apache2 server using a raspberry pi 4B model, so you should have some experience.

Side note: if you haven’t experimented with a raspberry pi I highly recommend it. They can encompass a wide range of practical projects, and teach you so much on the…

Dijkstra’s algorithm is an algorithm used to find all of the shortest distances between a start vertex and the rest of the vertices in a graph. Above you can see we start at A, and from there we will find the shortest distance to all other vertices. Dijkstra uses breadth-first search algorithm, and updates the cost of each edge updating the cost-list when it comes across an edge path that is less than what it already has.

From the start we assume every edge has a cost of infinity (this is impossible) so when it comes across the first edge…

example of depth-first-search

I wanted to discuss two types of graph search algorithms, as they are important concepts in working with graph structures.

The first is known as Depth First Search (DFS). As you can see in the gif above it travels down the vertices of a graph one by one via its connected vertex. Once it reaches the end of the branch at vertex #4 it checks back with vertex #1 to see if there was another neighboring vertex to run through.

Binary Search vs Linear Search methods

Two common search methods are linear, where we iterate through a list one-by-one till we find the value we want, or binary, where we apply a search formula/logic to more quickly find our target. There are benefits for both, and I wanted to go over them today.

When implementing a search algorithm it’s always important to consider the situation you’ll be in. Linear searches are considered better when you expect to find your target value at the beginning of a list, or if it’s a rather small list to begin with.

Binaries are better with larger data sets, and if…

Radix Sort

You ever just study something that’s made you mad? Like programming doesn’t need to be this hard, and yet you still find yourself trying to understand Radix Sort. I’d like to promise you that everything is going to be okay, but you know what, we can’t know everything, and maybe some things are just worth sitting out.

Go home. I won’t be mad.

Now for the rest of you sadist sticking around I’m going to explain Radix Sort. Am I going to explain it well? I dunno yet, but explaining things helps me learn so if you don’t find this…

example of quick sort logic

Quick-sort is another divide and conquer algorithm like the merge_sort algorithm. Quick-sort’s unique method however makes it oddly efficient, and thus popular.

It’s a recursion operation, and calls upon itself to break an array into multiple sub-list. The final sub-list will have just one element left before it breaks out of its recursion with an assorted list.

The idea is that on each level of the sub-list to grab a random element, otherwise known as the pivot, and compare it to the rest of the list, pushing smaller values to the left, and greater values to the right. Doing this…

Continuing my series on python sorting algorithms today I’m going to look at Merge Sort. Merge sort is a divide, and conquer strategy where it breaks down your list into halves repeatedly until it has just one element, and reconstructs the list in order. It even uses my favorite recursion method.

Abel Garrido

I’m a web developer, and data scientist by hobby. Yes, it can be a hobby. I blog about all things code.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store