Sorting data into a particular order is a universal programming concept. While Python boasts in-built functions like sort(), in this tutorial we will explore how to arrange numbers in ascending order without using this function.

Being able to implement such ordering from scratch is a fundamental skill for problem-solving in Python and becoming proficient in data manipulation.

### Step 1: Define the numbers to be sorted

The first step is to define a list of numbers that you wish to sort in ascending order. This list can either be hard-coded, or can come from an external source such as a file, an API, or a user input.

1 |
numbers = [4, 2, 9, 6, 5, 1] |

### Step 2: Implement the sorting algorithm

The next step is to implement a sorting algorithm. For simplicity, we will use the bubble sort algorithm in this tutorial, which works by repeatedly stepping through the list, comparing each pair of adjacent items, and swapping them if they are in the wrong order.

1 2 3 4 |
for i in range(len(numbers)): for j in range(i + 1, len(numbers)): if numbers[i] > numbers[j]: numbers[i], numbers[j] = numbers[j], numbers[i] |

After running this code block, the **numbers** list should now be sorted in ascending order.

### Step 3: Print or return the sorted list

Finally, you might want to print the sorted list to the console or return it from a function. Here’s the code to print the sorted list:

1 |
print(numbers) |

## Full code

Here is the full code for arranging the numbers in ascending order without using the sort function:

1 2 3 4 5 6 7 8 |
numbers = [4, 2, 9, 6, 5, 1] for i in range(len(numbers)): for j in range(i + 1, len(numbers)): if numbers[i] > numbers[j]: numbers[i], numbers[j] = numbers[j], numbers[i] print(numbers) |

## Output

After running the above code, you should see this output:

[1, 2, 4, 5, 6, 9]

## Conclusion

In this tutorial, you learned how to **arrange numbers in ascending order in Python** without using the built-in sort() function. Implementing this core programming task from scratch helps to enhance problem-solving skills and demonstrates the depths of data manipulation possible within Python. Despite these benefits, Python’s in-built sorting function is still a powerful and efficient tool for real-world programming tasks.