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 510 views
1 answer 296 views
1 answer 303 views
1 answer 283 views
1 answer 293 views
2 answers 367 views
...