Get the First and Last Digit of a Number in Python

Get first and last digits of a number in Python

Recently, I was working on a project where I needed to extract the first and last digit of a number in Python. At first, I thought Python might have a built-in function for this. But just like in Excel, where some features require workarounds, in Python, we need to use a few tricks. In this … Read more >>

Get the First Digit of a Number in Python

how to get first digit of a number in python

I was working on a project where I needed to extract the first digit of a number in Python. At first, it sounds simple, but depending on the approach you use, there are multiple ways to solve this. As someone who has been writing Python code for more than 10 years, I’ve faced this requirement … Read more >>

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 >>

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 >>

Find Armstrong Numbers in an Interval in Python

armstrong number in python

I was working on a Python project where I needed to filter out all Armstrong numbers within a given range. Python doesn’t have a direct function for Armstrong numbers either. So, I had to come up with a simple program to check each number in the interval and return only those that qualify as Armstrong … Read more >>

Python Program to Swap Two Elements in a List

Python program to swap two elements in a list

Recently, I was working on a data-cleaning project where I had to reorder elements in a customer list.The challenge was simple: swap two items in a Python list. At first, I thought there might be a single “built-in” function to do this. But as I explored, I realized there are multiple ways to swap elements … 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 >>

51 Python Programs

51 PYTHON PROGRAMS PDF FREE

Download a FREE PDF (112 Pages) Containing 51 Useful Python Programs.

pyython developer roadmap

Aspiring to be a Python developer?

Download a FREE PDF on how to become a Python developer.

Let’s be friends

Be the first to know about sales and special discounts.