001. Codewars 之 Shortest Word 解法
2017-02-28 本文已影响0人
伟健Wiken
x Simple, given a string of words, return the length of the shortest word(s).
String will never be empty and you do not need to account for different data types.
def find_short(s):
# your code here
return l # l: shortest word length
Solution:
def find_short(s):
word_list = s.split()
len_list = []
for word in word_list:
len_list.append(len(word))
l = min(len_list)
return l