Last active
April 2, 2019 06:37
-
-
Save prmishra/a87b19218290be39972891b276218800 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def index_words(text): | |
result = [] | |
if text: | |
result.append(0) | |
for index, letter in enumerate(text): | |
if letter == ' ': | |
result.append(index + 1) | |
return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment