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 328 views
1 answer 187 views
1 answer 198 views
1 answer 184 views
1 answer 161 views
2 answers 237 views
...