How to Swap Two Numbers in Python Using Function?

swap two numbers in python using function

Recently, while working on a data-cleaning script, I needed to swap two numbers in Python inside a function. At first, it seemed like a simple task, but I soon realized that many beginners struggle with writing reusable functions for this. I have often seen new learners overcomplicate this problem. The good news is, Python makes … 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 >>

How to Skip a Line in Python?

how to skip a line in python code

When I first started coding in Python, one of the simplest things I needed was to skip a line in my output. It may sound simple, but when you are formatting reports, working with text files, or cleaning large datasets, being able to skip lines can make your code much more readable and your output … Read more >>

Python Iterate through Dictionary by Index

python iterate dictionary

Recently, I was working on a project where I had to process customer data stored in a Python dictionary. The challenge was that I needed to access dictionary items not just by key or value, but by their index position. At first, this felt tricky because dictionaries in Python are not traditionally indexed like lists. … Read more >>

Difference between append() and extend() in Python

append and extend in python

When I started working with Python lists, I often confused the append() and extend() methods. Both looked like they were adding elements to a list, but the results were not always what I expected. Over the years, I realized that many beginners face the same confusion. So, in this tutorial, I will walk you through … Read more >>

Python Program to Find Product of Three Numbers

product of three numbers

As a part of my project, I was working with a dataset where I needed to multiply three different values together. At first glance, it looked like a simple task, but I realized many beginners often struggle with writing clean and reusable code for such cases. In this tutorial, I will show you how to … Read more >>

Check If Set is Empty in Python

How to Check if a Python Set is Empty

I was working on a data-cleaning project where I had to manage a large collection of unique values. Since I was using Python sets, I often needed to check whether a set was empty before performing operations on it. The challenge was that Python does not have a direct function like isEmpty() for sets. Instead, … Read more >>

How to Create a List in Python?

python create list

When I first started coding in Python, lists were the very first data structure I used. I realized how powerful they are. A Python list can hold numbers, strings, or even a mix of both. It’s like having a flexible container where you can store and organize your data. Over the years, I’ve used lists … 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.