How to find min length string from list of strings in Python

1 Answer

0 votes
lst = ['java', 'python', 'php', 'vb.net', 'c#', 'c+', 'c++']
  
str = min(lst, key=lambda s: len(s))
  
print(str)
 
 
 
'''
run:
 
c#
 
'''

 



answered Feb 4, 2020 by avibootz
edited Feb 4, 2020 by avibootz

Related questions

...