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

1 Answer

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



'''
run:

python

'''

 



answered Feb 2, 2020 by avibootz

Related questions

3 answers 349 views
1 answer 196 views
1 answer 213 views
1 answer 194 views
1 answer 166 views
2 answers 248 views
...