Jumlah elemen Python dalam array multidimensi

#Example for a 2D list
an_array = [[1, 2], [3, 4, 5]]
total_length = sum(len(row) for row in an_array)
print(total_length)
#OUTPUT: 5
Obedient Opossum