Sunday, September 15, 2024

## Search Algorithms and Path Navigation

In this post, I introduce two fundamental search algorithms used to traverse or search through graphs or tree data structures: breadth-first search (BFS), and depth-first search (DFS). I also present an overview of a path/search navigation scripts for both algorithms and compare their metrics. This post builds on my earlier post about stack and queue […]

## Pangram Verifier (Python)

Objective Write a script that takes a user-input and checks if it’s a pangram. A pangram is a sentence/phrase/string that contains all letters of the alphabet (in this case, English) at least once. However, technically, a pangram doesn’t necessarily have to be a grammatically correct sentence. The goal of a pangram is to include every […]

## Creating a Pangram Phrase with Python

Introduction A pangram is a sentence that contains every letter of the alphabet at least once. The most famous example in English is “The quick brown fox jumps over the lazy dog.” Pangrams are not only fun to create but also useful in various applications, such as testing fonts and keyboards. Technically, a pangram doesn’t […]

## Classifying Emails as Spam or Ham Using Naive Bayes

In this blog post, we’ll explore how to use the Naive Bayes algorithm to classify emails as either spam or ham (non-spam). We’ll walk through a Python implementation using the MultinomialNB classifier from the scikit-learn library. This method is particularly effective for text classification problems. Step-by-Step Implementation Importing Libraries: We start by importing the necessary libraries: Loading the Dataset: […]

## Venn Diagrams (Python)

Venn diagrams are versatile and useful for a variety of purposes. Some common uses are: Visualizing Relationships: They illustrate the logical relationships between different sets. For example, they can show how different groups overlap and share common elements, and which don’t.Comparing and Contrasting: They are great for comparing and contrasting different items, ideas, or groups. […]

## Generating quick fractals in Turtle

In this post, I share a quick way to generate impressive fractal images using Python and Turtle library. Both real-time demo and code provided. I’m using all official Seahawks NFL team colors in drawing three distinct circles, each in a loop with a certain radius. The radius of each circle is pseudo-randomly chosen from a […]

## Numbers to spoken words

How do you say this number: 8129311136456.25? Not easy even in your native language, and far less so in a foreign one. But don’t worry, in this blog I share the solution. The number, no matter how gnarly, you enter will be converted to a spoken word…even in foreign languages. Okay, before I reveal the […]

## A scalable, fun Fill-in-the-blank game in Python

In this post, I share the code and design of my quick but scalable script for writing a fill-in-the-blank application written in Python. You can play a smaller version of the game right here on this page (below). At the end of the post, you’ll find a link to a more refined, UI-polished, online version […]

## Creative and Fun Uses of Hashing (Part 2)

In an earlier post, I demonstrated a fun and creative use of hashing to create unique visual signatures based on any input. In this post, I’ll create add another twist to it. Specifically, I’ll show another creative use of hashing where we can input any city name and get it’s real-time weather information, and based […]

## Saving output from Turtle as an image (Python)

Saving output from the turtle module in Python involves a few unique steps compared to other libraries. The turtle module primarily uses the Tkinter canvas to render graphics, and saving these drawings typically requires converting the canvas to a PostScript file using the postscript() method. This file can then be converted to more common image […]