Skip to content

Commit 245fb36

Browse files
Update split.py
1 parent b5b436e commit 245fb36

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

strings/split.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@ def split(string: str, separator: str = " ") -> list:
2020
"""
2121

2222
split_words = []
23-
last_index = 0
2423

24+
last_index = 0
2525
for index, char in enumerate(string):
2626
if char == separator:
27-
split_words.append(
28-
string[last_index:index]
29-
) # Add substring between separators
27+
split_words.append(string[last_index:index])
3028
last_index = index + 1
3129
if index + 1 == len(string):
3230
split_words.append(string[last_index : index + 1])

0 commit comments

Comments
 (0)