Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # list_longest.py
- L = ['1' , '12', '123', '123aaa', '123bbb', '123ccc', '99abc', 'abc', 'zzz']
- L = sorted(L,key=len)
- le = len((L)[-1])
- ans = [x for x in L if len(x) == le]
- print ans
- # ['123aaa', '123bbb', '123ccc']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement