How to Remove NaN Values from a List in Python

How to remove nan from a list in python

While cleaning a dataset for a project, I ran into an issue where my Python list had a mix of numbers and NaN values. If you’ve worked with real-world data in the US, say, sales reports, healthcare data, or survey results, you know how common missing values can be. The problem is simple: NaN (Not … Read more >>

Capitalize the First and Last Letters of Each Word in Python String

program to capitalize first and last letter of string in python

Recently, I was working on a text-cleaning project where I had to format customer names for a U.S.-based retail dataset. The requirement was unusual; instead of simply capitalizing the first letter of each word, I needed to capitalize both the first and last letters of every word in the string. At first, I thought Python’s … Read more >>

Traffic Signal Program in Python

write python program for traffic signals

When I first started learning Python more than a decade ago, I loved building small projects that looked like real-world systems. One of my favorites was a traffic signal program. It’s simple, fun, and surprisingly practical. If you live in the USA, you see traffic lights every day, green for go, yellow for slow down, … Read more >>

Get Alternate Letters from String in Python

Python program to print alternate characters in a string using string slicing

As a developer, I was working on a project where I needed to extract every alternate character from a string. At first, I thought Python might have a built-in function for this. But as I explored, I realized there are multiple simple ways to achieve it. In this tutorial, I’ll show you five easy methods … Read more >>

How to Check Armstrong Number in Python

Python Program to Check Armstrong Number

I was working on a coding exercise where I had to check if a number was an Armstrong number. At first, it seemed like a simple task, but I realized many beginners struggle with the concept. As someone who has been coding in Python for more than 10 years, I’ve often seen Armstrong number problems … Read more >>

Count Upper and Lower Case Characters in Python

how to count uppercase and lowercase in python

When I was working on a text-processing project, I had to analyze customer feedback collected from different U.S. states. The challenge was simple: I needed to count how many uppercase and lowercase characters were present in each feedback entry. At first, I thought there might be a single built-in function in Python to do this … Read more >>

Capitalize First Letter of Each Word in String in Python

python capitalize every word using title() method

Recently, I was working on a text-cleaning project where I had to format customer names properly.The issue was simple: I had names written in lowercase like “john smith” or “michael o’brien”. In most cases, we want names, addresses, or report titles to look professional, which means each word should start with a capital letter. Python … Read more >>

Count and Display Vowels in a String in Python

Python program to check vowels using recursion

I was working on a text-processing project where I needed to quickly count and display vowels in a string. At first, I thought this would be an easy task. But as I explored, I realized there are multiple ways to achieve this in Python, each with its own advantages. In this tutorial, I’ll share five … Read more >>

Python Program for Selection Sort

Selection sort using Python

When I was working with sorting algorithms, I remember struggling with the logic behind them. At that time, I was working on a small project where I needed to sort a dataset of student grades. I could have used Python’s built-in sort() function, but I wanted to understand how sorting really worked behind. That’s when … Read more >>

Python Replace Whitespaces with Underscore

python replace space with underscore

In many real-world projects, especially when dealing with file names, column headers in CSV files, or user-generated content, I often had to replace spaces with underscores. For example, if I had a file name like Annual Report 2025.pdf, I needed to convert it into Annual_Report_2025.pdf so that it’s easier to handle in code and doesn’t … Read more >>