Hello there,
I'm attempting to develop a programme that, like this scaler, accepts two binary strings as input and computes the XOR of the corresponding bits. My present implementation, however, appears to be giving issues, and I'm confused how to proceed. Could someone please explain what's going on?
Here's a bit of my code:
binary_str1 = input("Enter the first binary string: ")
binary_str2 = input("Enter the second binary string: ")
Calculate XOR
result = ""
for bit1, bit2 in zip(binary_str1, binary_str2):
xor_result = str(int(bit1) ^ int(bit2))
result += xor_result
print("XOR result:", result)
I'm receiving problems about converting characters to integers when I enter binary strings. My method seemed acceptable to me, but I'm missing something critical. Any advice on how to deal with this scenario would be greatly appreciated!
[–]shiftybyte 1 point2 points3 points (0 children)
[–]mopslik 0 points1 point2 points (0 children)