[Solved] How do i sort a 2D array or multiple arrays by the length of the array using bubble sort


You can do this, the only difference being the condition used is the length of the array instead of an individual value.

n = len(arr)
for i in range(n):
    for j in range(n-i-1):
        if len(arr[j]) > len(arr[j+1]):
            arr[j], arr[j+1] = arr[j+1], arr[j]

2

solved How do i sort a 2D array or multiple arrays by the length of the array using bubble sort