Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- enumerate
- MAX
- slice
- WECODE
- len
- 파이썬
- sum
- list
- join
- FOR
- split
- SQL
- Python
- 위코드
- iNT
- count
- LOWER
- range
- index
- map
- or
- Algorithm
- If
- lambda
- decorator
- js
- and
- STR
- DART
- Sorted
Archives
- Today
- Total
코드로 우주평화
Shortest Word 본문
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 |