#!/usr/bin/env python a = [ [5,2,3], [1], [6,1,9], [2,0] ] a = sorted(a, key = lambda item: sum(item)/len(item) ) print(a)