+ 1

Compiler error (specific or non-specific)

#🤣check calculator ee=0^0 print (str(ee)) Why does the compiler give 0 as the answer ?

26th Mar 2021, 3:42 AM
Sanjay Kamath
Sanjay Kamath - avatar
5 ответов
+ 5
This is the truth table for XOR operation: a ^ b = c ------------------- 0 ^ 0 = 0 0 ^ 1 = 1 1 ^ 0 = 1 1 ^ 1 = 0 So the answer is not wrong.
26th Mar 2021, 3:59 AM
Abir Hasan
Abir Hasan - avatar
+ 3
Because the xor of 0^0 equals 0. xor is a bitwise operator that only returns 1 for the bit if 1 of the bits, but not both, is 1. 0 in bits equals 00000000 (1 byte) So 00000000 00000000 ‐----------------- 00000000 XOR TABLE A | B | XOR 0 | 0 | 0 0 | 1 | 1 1 | 0 | 1 1 | 1 | 0
26th Mar 2021, 3:55 AM
ChaoticDawg
ChaoticDawg - avatar
26th Mar 2021, 4:12 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
you've at least posted two questions related to this xor operator in few days, where you already get answers: https://www.sololearn.com/Discuss/2734360/?ref=app https://www.sololearn.com/Discuss/2729051/?ref=app
26th Mar 2021, 2:44 PM
visph
visph - avatar