MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / index_words

Function index_words

example_code/item_043.py:51–58  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

49
50print("Example 1")
51def index_words(text):
52 result = []
53 if text:
54 result.append(0)
55 for index, letter in enumerate(text):
56 if letter == " ":
57 result.append(index + 1)
58 return result
59
60
61print("Example 2")

Callers 1

item_043.pyFile · 0.85

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected