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 508 views
1 answer 293 views
1 answer 300 views
1 answer 280 views
1 answer 290 views
2 answers 365 views
...