I guess you are trying to do something like this:

data_list = [-5, -23, 5, 0, 23, -6, 23, 67]
new_list = []

while data_list:
    minimum = data_list[0]  # arbitrary number in list 
    for x in data_list: 
        if x < minimum:
            minimum = x
    new_list.append(minimum)
    data_list.remove(minimum)    

print (new_list)

#Added parenthesis

Answer from John La Rooy on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › sort-a-list-in-python-without-sort-function
Sort a list in Python without sort Function - GeeksforGeeks
July 4, 2025 - Bubble Sort is a simple comparison-based sorting algorithm. It works by repeatedly swapping adjacent elements if they are in the wrong order. In this case, it checks if the left element is smaller than the right and swaps them to sort in descending ...
Discussions

sorting a list WITHOUT sort
I think I can solve it with if, elif, else but I don't know where to start even. Write a function to sort a list of two items. You can sort any list by sorting two items at a time over and over again, it's called a "bubble sort." More on reddit.com
🌐 r/learnpython
40
1
April 8, 2020
Sorting arrays in python
In python we much prefer to use nested lists instead of parallel lists. We can convert your data to a nested list using zip(): nested_data = list(zip(myList, mylables)) Now sorting is the same as before: sorted_data = sorted(nested_data, reverse=True) Depending on what you want to do with the data you may be done. For example if you want to print it out: for dat, label in sorted_data: print(label, dat) I need to keep it so that a sortedlabellist is its own individual array (for future things) Hmm, I don't believe you, but if that's actually true you can use zip() again to convert it back: myList, mylables = zip(*sorted_data) More on reddit.com
🌐 r/learnpython
4
1
April 29, 2021
Array should have a sort method - Ideas - Discussions on Python.org
Hello, Arrays are a space efficient way of storing numeric values in Python. However, there doesn’t seem to be any space efficient way to order them. It’s possible to use the built-in sorted function, but it will return a list and that will cancel all space efficiency gains of arrays. More on discuss.python.org
🌐 discuss.python.org
3
February 18, 2025
How to sort an array without using another array?
The target solution is not sorted (it starts with 3 2 3 and ends with 6 8 6). So any standard sort algorithm is not going to produce that output. What is being asked is just a partition of the values. x is 5, so array[5] is 4 (indexes start at 0 in Python). All it is asking is that you swap values less than 4 in array positions 0..4 with values greater than 4 in array positions 6..10. There are two dumb things about this question. (a) It happens that the first part of a[] has three values that need moving (5,6,8) and the second part also has three that need moving (4,4,3). But that need not be true. You would need to count the lower and higher values and shift a[5] to leave the correct amount of room for them. Extreme example: if the input was 1 2 3 1 2 4 1 2 3 1 2 then the 4 would have to end up in a[10]. (b) This has multiple possible solutions (I think 36). For example, a valid solution could start with 2 3 3 or 3 2 3 or 3 3 2. It could end with 8 6 6 5 or 6 8 5 6. So saying you have to product their value exactly in this case means you have to guess exactly how their algorithm is implemented. The reason there are 36 solutions: There are 6 permutations of any three objects a b c, but it as there are two 3s and we cannot tell the difference, we halve the count to 3. Likewise, there are 24 permutations of four objects, but there are two 6s. Whoever set this question does not understand what they are asking for. More on reddit.com
🌐 r/CodingHelp
10
0
September 2, 2023
People also ask

Q1. Why is sorting important in Python?
Sorting organizes data, making it easier to search, retrieve, and analyze. It is widely used in databases, data science, and ranking search results.
🌐
intellipaat.com
intellipaat.com › home › blog › how to sort a list in python without using sort function
How to Sort A List in Python Without Using Sort Function?
Q2. Can we sort a list without sort()?
Yes, a list can be sorted manually using loops, swapping, or sorting algorithms like Bubble Sort, Selection Sort, and Insertion Sort.
🌐
intellipaat.com
intellipaat.com › home › blog › how to sort a list in python without using sort function
How to Sort A List in Python Without Using Sort Function?
Q4. Which methods can replace sort()?
Some common techniques include Bubble Sort, Selection Sort, Insertion Sort, Merge Sort, and Quick Sort for arranging data.
🌐
intellipaat.com
intellipaat.com › home › blog › how to sort a list in python without using sort function
How to Sort A List in Python Without Using Sort Function?
🌐
Flexiple
flexiple.com › python › sort-list-python
How to sort a list in python without the sort function - Flexiple
The Bubble Sort algorithm is simple and easy to understand. It compares neighbouring elements in the list and swaps them if they are in the wrong order. This process is repeated until the list is completely sorted.
🌐
Quora
quora.com › How-do-you-sort-a-list-in-Python-without-using-the-sort-function
How to sort a list in Python without using the sort function - Quora
Answer (1 of 4): [code]number = [64, 25, 12, 22, 11, 1,2,44,3,122, 23, 34] for i in range(len(number)): for j in range(i + 1, len(number)): if number[i] > number[j]: number[i], number[j] = number[j], number[i] print (number) [/code]
🌐
Reddit
reddit.com › r/learnpython › sorting a list without sort
r/learnpython on Reddit: sorting a list WITHOUT sort
April 8, 2020 -

so, I started studying python via class, therefore we have assignments and I got stuck.we were given a list of names, and we need to write a code that prints the list in alphabetical order.

I think I can solve it with if, elif, else but I don't know where to start even. I've been stuck on this for 2 days now.

EDIT: we are NOT allowed to use any techniques they haven't taught us. so no sort of any kind, no use of a for while loop, not in range....

🌐
YouTube
youtube.com › watch
How to sort any list or array in python without using (sort method) | Sort an array in Python Logic - YouTube
How to sort an array in Python?| How to build logic for sorting?In this video tutorial, you will learn about how to sort an array without using any inbuilt m...
Published   June 18, 2023
Find elsewhere
🌐
pythoncodelab
pythoncodelab.com › home › how to sort a list in python without the sort function.
How to sort a list in python without the sort function. -
November 2, 2024 - The time and space complexity of select sort is O(n²) and O(1) respectively. We saw how to sort a list in python without the sort function using bubble sort and selection sort. Algorithms have time and space complexity.
🌐
Python documentation
docs.python.org › 3 › howto › sorting.html
Sorting Techniques — Python 3.14.4 documentation
February 23, 2026 - The standard library provides several tools that do less work than a full sort: min() and max() return the smallest and largest values, respectively. These functions make a single pass over the input data and require almost no auxiliary memory.
🌐
Brainly
brainly.in › computer science › secondary school
how to sort a list in python without sort function - Brainly.in
December 31, 2022 - Given an array of size n, set up the primary okay elements of the array in ascending order and the ultimate n-k factors in descending order. ... There are several ways to sort a list in Python without using the built-in sort() function.
🌐
Tutorialspoint
tutorialspoint.com › python › python_sort_arrays.htm
Python - Sort Arrays
An object of array class is similar ... either strings, or integers, or float objects. The array class doesn't have any function/method to give a sorted arrangement of its elements....
🌐
Python Forum
python-forum.io › thread-5605-page-2.html
Manual Sort without Sort function
Hello, I'm currently taking a python class, I really enjoy it but I'm having a issue with getting my code for a upcoming assignment to work. The teacher wants us to sort 3 numbers in acceding order without using the sort function built into python. A...
🌐
GeeksforGeeks
geeksforgeeks.org › python › sort-in-python
sort() in Python - GeeksforGeeks
The sort() method in Python is used to arrange the elements of a list in a specific order. It works only on lists, modifies the original list in place, and does not return a new list.
Published   January 13, 2026
🌐
Reddit
reddit.com › r/learnpython › sorting arrays in python
r/learnpython on Reddit: Sorting arrays in python
April 29, 2021 -

I have an array of variable numbers.

I have another array that I want to be the of labels for the numbers array.

myList = [T1_sum, T2_sum, T3_sum, T4_sum, T5_sum, T6_sum, T7_sum, T8_sum, T9_sum, T10_sum]

mylables = ["cats", "dogs", "monkey", "fish", "rabbit", "owl", "pig", "goat", "cow", "bull"]

I want to sort the array by highest to lowest value. I did this by:

sortedlist = sorted(myList, reverse=True)

However, how do I rearrange the labels so that they are in line with the values?

I need to keep it so that a `sortedlabellist` is its own individual array (for future things). so i will probably have to link the values to the labels and then pull out a `sortedlabellist` separately?

🌐
Python.org
discuss.python.org › ideas
Array should have a sort method - Ideas - Discussions on Python.org
February 18, 2025 - Hello, Arrays are a space efficient way of storing numeric values in Python. However, there doesn’t seem to be any space efficient way to order them. It’s possible to use the built-in sorted function, but it will return a list and that will cancel all space efficiency gains of arrays.
🌐
Google
developers.google.com › google for education › python › python sorting
Python Sorting | Python Education | Google for Developers
The easiest way to sort is with the sorted(list) function, which takes a list and returns a new list with those elements in sorted order.
🌐
Reddit
reddit.com › r/codinghelp › how to sort an array without using another array?
r/CodingHelp on Reddit: How to sort an array without using another array?
September 2, 2023 -

You are given an array of integers and an index x.

Without sorting Re-arrange the array as below:

elements less than array[x], followed by elements equal to array[x], fol-

lowed by elements greater than array[x]

Array, a = [3,5,2,6,8,4,4,6,4,4,3] and x = 5

Write a Python Program that re-arranges the above given array exactly

as shown below without using a sorting routine of any kind

output array = [3,2,3,4,4,4,4,5,6,8,6]

Here You are not allowed to use an extra array to solve the problem

Top answer
1 of 4
3
The target solution is not sorted (it starts with 3 2 3 and ends with 6 8 6). So any standard sort algorithm is not going to produce that output. What is being asked is just a partition of the values. x is 5, so array[5] is 4 (indexes start at 0 in Python). All it is asking is that you swap values less than 4 in array positions 0..4 with values greater than 4 in array positions 6..10. There are two dumb things about this question. (a) It happens that the first part of a[] has three values that need moving (5,6,8) and the second part also has three that need moving (4,4,3). But that need not be true. You would need to count the lower and higher values and shift a[5] to leave the correct amount of room for them. Extreme example: if the input was 1 2 3 1 2 4 1 2 3 1 2 then the 4 would have to end up in a[10]. (b) This has multiple possible solutions (I think 36). For example, a valid solution could start with 2 3 3 or 3 2 3 or 3 3 2. It could end with 8 6 6 5 or 6 8 5 6. So saying you have to product their value exactly in this case means you have to guess exactly how their algorithm is implemented. The reason there are 36 solutions: There are 6 permutations of any three objects a b c, but it as there are two 3s and we cannot tell the difference, we halve the count to 3. Likewise, there are 24 permutations of four objects, but there are two 6s. Whoever set this question does not understand what they are asking for.
2 of 4
2
Note that you can use a temporary variable to swap two elements of the array.
🌐
W3Schools
w3schools.com › python › numpy › numpy_array_sort.asp
NumPy Sorting Arrays
Ordered sequence is any sequence that has an order corresponding to elements, like numeric or alphabetical, ascending or descending. The NumPy ndarray object has a function called sort(), that will sort a specified array.
🌐
ACTE
acte.in › home › explaining python list sorting without a sort function
Learn Python List Sorting Without Sort Function | Updated 2026
CyberSecurity Framework and Implementation Article
Python List Sorting Without Sort Function: Learn How to Sort a List in Python Without the Sort Function, Your Level of Programming Knowledge and Sorting Strategies. One of best Institute to learn CyberSecurity Framework and Implementation from ACTE . Really impressive model where you can learn technical Skills , Soft Skill and get help to kick start your first Job as well.
Rating: 5 ​
🌐
Intellipaat
intellipaat.com › home › blog › how to sort a list in python without using sort function
How to Sort A List in Python Without Using Sort Function?
November 11, 2025 - NumPy is a library in Python that is mainly used for numerical computing. It has a numpy.sort() function that sorts arrays efficiently.