In this article, we are going to create a python function which will take in a list of lists, and then merge them together and sorts the numbers in the new python list from the smallest to the largest.

The function is fairly simple, if you have better idea to make it more simple then do leave your comment below this post.

def flatten_and_sort(array):
    
    sorted_array = []
    for arr in array:
        sorted_array += arr
    sorted_array.sort()
    return sorted_array

The sort method of the python list make sorting numbers or words easy and simple!

Please follow and like us:
error0

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *