he-011
1.000
Proposed solution
Looking at this problem, I need to implement a function that performs XOR operation on two binary strings.
Let me break down what's needed:
1. Take two strings `a` and `b` containing only '0' and '1' characters
2. Perform bitwise XOR operation on them
3. Return the result as a string
For XOR operation:
- 0 XOR 0 = 0
- 0 XOR 1 = 1
- 1 XOR 0 = 1
- 1 XOR 1 = 0
I'll iterate through both strings character by character and apply XOR logic.
```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'
"""
result = ""
for i in range(len(a)):
if a[i] == b[i]:
result += "0"
else:
result += "1"
return result
```Test output (stdout)
. [100%] 1 passed in 0.01s
System prompt
You are an expert programmer. Solve the task exactly as specified. Output your solution as fenced code blocks using the required file name(s) and the exact function/type signatures requested. Prefer correctness; do not include prose outside code unless asked.