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
2
April 8, 2020
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
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
arrays - Fastest way to sort in Python - Stack Overflow
What is the fastest way to sort an array of whole integers bigger than 0 and less than 100000 in Python? But not using the built in functions like sort. Im looking at the possibility to combine 2 ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
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.
๐ŸŒ
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 bubble sort is O(nยฒ) and O(1) respectively. ... Initially, we consider the whole list as unsorted. ... We start by searching the smallest number in the unsorted part of the list, which is 11.
๐ŸŒ
Python documentation
docs.python.org โ€บ 3 โ€บ howto โ€บ sorting.html
Sorting Techniques โ€” Python 3.14.6 documentation
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.
Find elsewhere
๐ŸŒ
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]
๐ŸŒ
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
๐ŸŒ
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....
๐ŸŒ
Java Guides
javaguides.net โ€บ 2023 โ€บ 11 โ€บ python-program-to-sort-list-without-sort-function.html
Python Program to Sort a List Without sort Function
November 6, 2023 - โ–ถ๏ธ For AI, ChatGPT, Web, Tech, and Generative AI, subscribe to another channel: Ramesh Fadatare on YouTube ยท Sorting a list is a common operation in programming. Python has a built-in sort() function and sorted() function for this purpose.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ sort-a-dictionary-without-using-sort-function-in-python
Sort a Dictionary Without Using Sort Function in Python - GeeksforGeeks
July 23, 2025 - In this article, we studied on how to sort a dictionary in Python without using the built-in sorted function. From this article we understood it can be achieved through various approaches. The presented methods showcase different techniques, including using the min function, custom sorting functions, the heapq module, recursion, and a loop with the sorted function.
๐ŸŒ
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...
๐ŸŒ
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.
๐ŸŒ
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 โ€‹
๐ŸŒ
Sololearn
sololearn.com โ€บ en โ€บ Discuss โ€บ 3304889 โ€บ sort-without-sort-function-and-bubble-sortin-python
Sort without sort function and bubble sort.In python | Sololearn: Learn to code for FREE!
I am making a code where I need to sort a list but I can't use sort function or bubble sort then how can I sort my list can anyone tell me https://sololearn.com/compiler
๐ŸŒ
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 - There are several methods for sorting the data in Python, which can be done using sorting techniques like quick sort, bubble sort, selection sort, and insertion sort, and it can also be done using the basic sort() function.
๐ŸŒ
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?