Advertisement
here2share

# list_longest.py

Sep 26th, 2017
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.23 KB | None | 0 0
  1. # list_longest.py
  2.  
  3. L = ['1' , '12', '123', '123aaa', '123bbb', '123ccc', '99abc', 'abc', 'zzz']
  4.  
  5. L = sorted(L,key=len)
  6.  
  7. le = len((L)[-1])
  8.  
  9. ans = [x for x in L if len(x) == le]
  10.  
  11. print ans
  12.  
  13. # ['123aaa', '123bbb', '123ccc']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement