Ad

Use the internal split method of the string-class.

Code
Diff
  • def split(string, separator):
        return string.split(separator)
    • def split(string, separator):
    • split_list = []
    • current_slice = ''
    • for char in string:
    • if char == separator:
    • split_list.append(current_slice)
    • current_slice = ''
    • else:
    • current_slice += char
    • split_list.append(current_slice)
    • return split_list
    • return string.split(separator)