Learn Python by Understanding Sorting

Welcome to our Python learning space!
This page is designed to help beginners understand fundamental programming logic through hands-on examples.

In the video below, we walk through the process of sorting a list of strings in Python — without using built-in functions like sort() or sorted(). Instead, you’ll learn how sorting actually works under the hood!

🎥 Watch the Tutorial:

Sorting alphabetically without in built functions in python

🔤 What We’re Sorting: A List of Bird Names

In this example, we work with a list of bird names:

pythonCopyEditbirds = ["mat", "cat", "bat"]

Our goal is to sort them alphabetically into:

pythonCopyEdit["bat", "cat", "mat"]

Rather than using shortcuts, we do it manually by:

  • Looping through the list
  • Comparing each pair of items
  • Swapping items where necessary

🔍 Key Python Concepts Covered

  • for loops and range()
  • String comparison using >
  • List indexing
  • Swapping values using a temporary variable
  • Step-by-step debugging logic