How to find the shortest string in array of strings in Python

1 Answer

0 votes
strings = ["c++", "python", "c#", "java", "swift"]

shortest_string = min(strings, key=len)

print(shortest_string)



'''
run:

c#

'''

 



answered Mar 7, 2021 by avibootz

Related questions

1 answer 155 views
2 answers 229 views
3 answers 212 views
2 answers 166 views
3 answers 356 views
2 answers 181 views
...