You may have heard of the classic puzzle: Two trains start from two towns, heading towards each other. One train leaves Town A heading towards Town B at some speed while at the same time, the other train leaves Town B heading towards Town A at another speed. If the distance between the two towns […]
Tag: python
Getting reading time of an online article and more
If someone sent you a link to page or article, ever wanted to know how long is the article before even opening and reading the article, or if you could get a sense of the server response time or the page load time, number of images and paragraphs in that article? Well, I did and […]
Sorting algorithms explained, compared
In this post, I discuss some common sorting algorithms, their logic, share their implementation (code), and demonstrate each one with executable scripts. Then I compare their performances to identify the most efficient sorting algorithm(s). You’ll get a good overview of each one, learn how to code and use them, and understand their strengths and weaknesses. […]
Understanding Step Charts (and creating them in Excel, Python)
Step charts are suitable for showing fluctuating or irregular values over time. There’s no built-in Step chart type in Excel, so most people use a Line chart instead, which is not really ideal or sometimes accurate (I’ll explain that below). With proper data shaping, it’s possible to create Step charts in Excel. In this post, […]
Combinations in Python
In this post, I present the concept of calculating combinations from different choices. For educational fun, I will combine various parts of the bodies from two different creatures and see how many combinations we get. You’ll get to enter the animals to combine, and even get a name for your new mutant! If you have […]
Overlay Real-time Animations Using Pygame
In this post, I demonstrate how to load an image file and do some simple overlay animations, such as drawing different shapes of different colors at ever-changing locations over the image using nothing but the good-old Pygame library. The code and working demo are embedded below. I wanted to load a static image of my […]
Calculating Playoff Chances
With the NFL regular season winding down after week 15, we have a pretty good idea of which teams are definitely out of the playoff hunt, which teams have clinched a playoff berth, but the rest are still up in the air. In this blog post, I calculate the chances of making the playoff for […]
Unicode transformation fun
In this post, I share some exercises of encoding a usual string of English/Latin alphabets into a readable Unicode version with styling but still into a text that can be copied/pasted anywhere without any special app, and then transform the input text into some interesting Unicode symbols (that can also be copied/pasted anywhere as text). […]
Custom Chess Board Setup for Sim and Puzzles
In addition to solving real-life and abstract challenges, I love playing chess and mulling over different scenarios. When I don’t want to play the entire game from beginning to end, but rather start at a climactic stage, it makes it even more exciting and challenging to play it to the end with someone or even […]
Brain Teaser: Palindrome Checker 45611-1445
Here is a quick Python coding puzzle or brain teaser for educational and/or entertainment purposes. The challenge is quite simple but is useful for learning or refreshing your coding skills while exercising some logical thinking. Objective Write a Python program that takes an input from the user (a word or a phrase) and tells the […]