he-029
0.000
Challenge · difficulty 1/5
# HumanEval/29
Implement a file **`solution.py`** that completes the function below. Keep the given name and signature; your file must define it at module level.
```python
from typing import List
def filter_by_prefix(strings: List[str], prefix: str) -> List[str]:
""" Filter an input list of strings only for ones that start with a given prefix.
>>> filter_by_prefix([], 'a')
[]
>>> filter_by_prefix(['abc', 'bcd', 'cde', 'array'], 'a')
['abc', 'array']
"""
```
<!-- imported from OpenAI HumanEval (HumanEval/29) -->
tests/test_he_029.py
# Auto-generated from OpenAI HumanEval HumanEval/29. Do not edit by hand.
from solution import * # noqa: F401,F403 (prompt helpers may be referenced by tests)
from solution import filter_by_prefix as candidate
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([], 'john') == []
assert candidate(['xxx', 'asd', 'xxy', 'john doe', 'xxxAAA', 'xxx'], 'xxx') == ['xxx', 'xxxAAA', 'xxx']
def test_he_029():
check(candidate)
Proposed solution
# HumanEval/29
Implementing a function **`filter_by_prefix([], 'a')**` returning **`['abc', 'array']**` because **`['a', 'array']**``` because **`['abc', 'array']**`` because **`['abc', 'array']**` because **`['abc', 'array']**` because **`['abc', 'cde', 'array', 'a']**` because **`['abc', 'array', 'a']**` because **`['abc', 'array', 'array', 'a']** because **`['abc', 'array', 'array', 'a']** because **`['abc', 'array', 'array', 'a']** because **`['abc', 'array', 'array', 'a']** because **`['abc', 'array', 'array', 'a']** because **`['abc', 'array', 'array', 'a']** because **`['abc', 'array', 'Errors (stderr)
no code extracted from response