Jul-09-2019, 06:58 AM
You are on right track (lines # 6 and 7) but slight adjustments needed.
You need:
- find minimum length from list elements
- find elements which length is equal to minimum length
You need:
- find minimum length from list elements
- find elements which length is equal to minimum length
>>> lst = [['1', '6', '66', '9', '33'], ... ['1', '6', '9', '33'], ... ['1', '66', '6', '9', '33'], ... ['1', '66', '9', '33'], ... ['1', '4', '9', '33']] >>> shortest = min(len(row) for row in lst) >>> shortest 4 >>> [row for row in lst if len(row) == shortest] [['1', '6', '9', '33'], ['1', '66', '9', '33'], ['1', '4', '9', '33']]
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.