How to sort numbers in python without sort function?
![](https://pythonpoint.net/wp-content/uploads/2020/12/Green-and-Purple-Dynamic-Frames-Action-_-Adventure-YouTube-Channel-Art-10-1024x576.jpg)
In python when ever we want to sort numbers we use sort() function.
The sort function makes it very easy to sort a numbers in python.
We can sort it without sort function also. And we’ll see it here.
e.g.,
l = [4, 8, 2, 1, 3, 9, 20, 15, 10, 33] n = [] while l: min = l[0] for i in l: if i < min: min = i n.append(min) l.remove(min) print(n)
![](https://pythonpoint.net/wp-content/uploads/2020/12/Screenshot-1001-1024x600.png)
This is how we can sort numbers in python without sort function.
Subscribe
Login
Please login to comment
0 Discussion