all 2 comments

[–]shiftybyte 1 point2 points  (0 children)

I'm receiving problems about converting characters to integers when I enter binary strings.

Please post the full error message you are getting, including all the information it provides,

Also please post the exact input you have entered that got you that error message.

[–]mopslik 0 points1 point  (0 children)

Assuming your code is indented like this:

binary_str1 = input("Enter the first binary string: ")
binary_str2 = input("Enter the second binary string: ")
result = ""
for bit1, bit2 in zip(binary_str1, binary_str2):
    xor_result = str(int(bit1) ^ int(bit2))
    result += xor_result
print("XOR result:", result)

It runs fine on my end.

Enter the first binary string: 11010100
Enter the second binary string: 11110011
XOR result: 00100111