본문 바로가기

알고리즘 공부

Checkio Firstword (Simplified)

5월 4일 First Word (simplified)

 

You are given a string where you have to find its first word.

This is a simplified version of the First Word mission.

Input string consists of only english letters and spaces.

There aren’t any spaces at the beginning and the end of the string.

Input: A string.

Output: A string.

Example:

first_word("Hello world") == "Hello"

def first_word(text: str) -> str:

return text.split()[0]