Write a Program to Find a Perfect Number in Python

perfect number in python

Recently, I was working on a small project where I needed to check if a number was a perfect number. At first, I thought Python might have a built-in function for this. But just like Excel doesn’t have a direct way to filter strikethrough cells, Python doesn’t come with a ready-made tool for perfect numbers. … Read more >>

Python Program to Calculate the Area of a Rectangle

write a program to find area of rectangle in python

When I first started teaching Python to beginners, one of the most common questions I got was: How do I calculate the area of a rectangle It’s a simple problem, but it’s also one of the best ways to understand how Python handles inputs, variables, and basic arithmetic. In this tutorial, I’ll show you step … Read more >>

Convert Month Name to Number in Python

dataframe to tensor

When I first started working with date-related data in Python, one of the most common problems I ran into was converting month names into numbers. For example, I often received data files where months were written as “January”, “Feb”, or “Sept”. But for analysis, I needed them as numbers like 1, 2, or 9. Over … Read more >>

How to Convert a List to a Tensor in TensorFlow

tf convert to tensor

When I first started working with TensorFlow, one of the things that confused me was how to take a regular Python list and turn it into a tensor. It sounds simple, right? But when you’re dealing with machine learning models, you often get data in lists or arrays, and you need to convert them into … Read more >>

Lambda in List Comprehension in Python

python list comprehension lambda

I was working on a data-cleaning task where I had to transform and filter a list of U.S. city names. I wanted a quick way to apply conditions and transformations without writing long functions. That’s when lambda with list comprehension came in handy. This combination gave me cleaner, more Pythonic code. In this tutorial, I’ll … Read more >>

Remove Special Characters From a String in Python

remove special characters except for space from a string in Python

Recently, I was working on cleaning up some text data for a project in the USA, where customer feedback was collected through multiple online forms. The issue? Many users typed in special characters like @, #, !, and %, which made the data messy and hard to analyze. But I noticed that I still needed … Read more >>

Get the Index of the Minimum Element in a Python List

Get the Index of the Minimum Element of a List in Python

I was working on a project where I had to find the position of the smallest number in a list. At first, I thought it would be simple. But then I realized there are multiple ways to do this in Python, each with its own advantages. In this tutorial, I’ll show you five simple methods … 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.