반응형
Description:
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.
Solution:
1. Count the number of letters in each word.
2. Returns the smallest number of characters.
def find_short(s):
return min(list(map(len, s.split())))
반응형
'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글
Apparently-Modifying Strings (0) | 2022.04.26 |
---|---|
The Office I - Outed (0) | 2022.04.24 |
Vowel Count (0) | 2022.04.22 |
String ends with? (0) | 2022.04.21 |
Remove the minimum (0) | 2022.04.20 |