How to sort numbers in python without sort function?
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)
This is how we can sort numbers in python without sort function.
Subscribe
Login
Please login to comment
0 Discussion