I want to sort the array [[x₁, y₁], [x₂, y₂], [x₃, y₃],...] by the first term. I know that it is doable with bubble sorting, but is there more concise and efficient way to sort the array? Here is a working code for bubble sorting.
def bubble_sort(n, array):
  for i in range(n):
    swap = False
    for j in range(n-i-1):
      if array[j][0] > array[j+1][0]:
        array[j][0], array[j+1][0] = array[j+1][0], array[j][0]
        swap = True
    if not swap:
      break
  return array
 
     
     
     
    