Skip to content

Instantly share code, notes, and snippets.

@prmishra
Last active April 2, 2019 06:37
Show Gist options
  • Save prmishra/a87b19218290be39972891b276218800 to your computer and use it in GitHub Desktop.
Save prmishra/a87b19218290be39972891b276218800 to your computer and use it in GitHub Desktop.
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