How to sort a list in python without sort function?
![](https://pythonpoint.net/wp-content/uploads/2020/12/Green-and-Black-Illustrated-Video-Game-Controller-Vector-YouTube-Channel-Cover-1024x576.jpg)
In python when ever we want to sort a list we use sort() function.
As sort function makes it very easy to sort a list 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 list in python without sort function.
Subscribe
Login
Please login to comment
0 Discussion