he-011
0.000
Challenge · difficulty 2/5
# HumanEval/11
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 string_xor(a: str, b: str) -> str:
""" Input are two strings a and b consisting only of 1s and 0s.
Perform binary XOR on these inputs and return result also as a string.
>>> string_xor('010', '110')
'100'
"""
```
<!-- imported from OpenAI HumanEval (HumanEval/11) -->
tests/test_he_011.py
# Auto-generated from OpenAI HumanEval HumanEval/11. Do not edit by hand.
from solution import * # noqa: F401,F403 (prompt helpers may be referenced by tests)
from solution import string_xor as candidate
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate('111000', '101010') == '010010'
assert candidate('1', '1') == '0'
assert candidate('0101', '0000') == '0101'
def test_he_011():
check(candidate)
Proposed solution
```python
def string_xor(a: str, b: str) -> str:
""" Input are two strings a and b consisting only of 1s and 0s.
Perform binary XOR on these inputs and return result also as a string.
>>> string_xor('010', '110') -> '100'
"""
```markdown :
```markdown :
```markdown :
```markdown :
```markdown :
```markdown :
```markdown :
```markdown :
```markdown :
```markdown :
```markdown :
```markdown :
```markdown :
```markdown :
```markdownTest output (stdout)
F [100%]
=================================== FAILURES ===================================
_________________________________ test_he_011 __________________________________
def test_he_011():
> check(candidate)
test_he_011.py:18:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
candidate = <function string_xor at 0x7f6bf023c900>
def check(candidate):
> assert candidate('111000', '101010') == '010010'
E AssertionError: assert None == '010010'
E + where None = <function string_xor at 0x7f6bf023c900>('111000', '101010')
test_he_011.py:12: AssertionError
=========================== short test summary info ============================
FAILED test_he_011.py::test_he_011 - AssertionError: assert None == '010010'
1 failed in 0.02s