Files

17 lines
542 B
Python

# HumanEval/101
# Loki Mode Multi-Agent Solution
# Attempts: 1
# Passed: True
def words_string(s):
"""
You will be given a string of words separated by commas or spaces. Your task is
to split the string into words and return an array of the words.
For example:
words_string("Hi, my name is John") == ["Hi", "my", "name", "is", "John"]
words_string("One, two, three, four, five, six") == ["One", "two", "three", "four", "five", "six"]
"""
if not s:
return []
return s.replace(",", " ").split()