Python Training _ 21

WONY_yoon·2025년 10월 20일
post-thumbnail

String Split By Delimiter

아래와 같은 문장을 공백으로 구분 후 단어 개수를 출력하는 함수 를 작성 후 실행하세요.

in_str = "Suppose we have few words that are separated by spaces."

출력 결과 : 10
# Python split() 함수는 자주사용해요.
# string.split(separator, maxsplit) : 구분자, 분할 수
# 기본 분리 지정자는 공백
# 문자열을 구분 후 리스트로 변환

0개의 댓글