Python 긴 단어 찾기

Development

[Python] 문장에서 가장 긴 단어 찾기

문장을 입력받아 가장 긴 단어를 찾는 예제를 작성해 보았다. 샘플코드 def find_longest_word(sentence): words = sentence.split() return max(words, key=len) # Example usage text = "It only takes about 20 minutes to find out about your accurate English level" print("Longest word:", find_longest_word(text)) 결과 Longest word: accurate

삿뿐삿뿐
'Python 긴 단어 찾기' 태그의 글 목록