Light Mode
Dark Mode
How To Pass The First Word Mission??

I have been trying, it returns a correct word for the first test:

def first_word(text: str) -> str:
    first_word = "" 
    for word in text.split():
        if word[0].isalpha():
            first_word = word
            break
    return first_word.strip()

Can any one suggest a better approach?

Created: July 26, 2023, 4:03 p.m.
Updated: July 27, 2023, 10:03 a.m.
1
6
User avatar
ayandahlongwa0766