This seems like a pretty simple problem, but I'm looking for a short and sweet way of doing it that is still understandable (this isn't code golf).
Given a list of strings, what's the easiest way to find the shortest string?
The way that is most obvious to me is roughly:
l = [...some strings...]
lens = map(l, len)
minlen, minind = min(lens)
shortest = l[minind]
strings = ["some", "example", "words", "that", "i", "am", "fond", "of"] print min(strings, key=len) # prints "i"