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.
def find_short(s):
alist=s.split(' ')
shortest=len(alist[0])
print(alist)
for i in alist:
if shortest>len(i):
shortest=len(i)
return shortest
'알고리즘 문제 > CodeWar' 카테고리의 다른 글
Ascend, Descend, Repeat? (0) | 2022.09.29 |
---|---|
Find the missing letter (1) | 2022.09.29 |
Split Strings (0) | 2022.09.29 |
Good vs Evil (0) | 2022.09.28 |
Disemvowel Trolls (0) | 2022.09.28 |