I have:
l = [[1,2,3],[3,4],[1,6,8,3]]
I want:
[[1,2],[3,4],[1,6]]
Which is the list l with all sublists truncated to the lowest length found for the sublists in l.
I tried:
min = 1000
for x in l:
if len(x) < min: min = len(x)
r = []
for x in l:
s = []
for i in range(min):
s.append(x[i])
r.append(s.copy())
Which works but quite slow and long to write. I'd like to make this more efficient through list comprehension or similar.