+ 2
At boolean why is print((2==2)+(3==3)) is 2
I don't get it where do 3 go and why it says 2 can you tell me the full explanation
6 Respuestas
+ 6
== is equality operator and returns 1 if the condition(both sides have equal value) is true and 0 otherwise
2==2 will return 1
3==3 will return 1
So the expression boils down to
(1+1) = 2
+ 3
Ohhhhh ok thank you guys✌🙂
+ 3
Comparison operator (==), is used to compare between two values and it gives answer in boolean.
So here 2==2 will give True also 3==3 will give True.
So when True and True will be added , the output will come 2.
Hope you understood😊
+ 2
Here 2==2 is true and thus it returns 1 .
Similarly 3==3 is also true and it also returns 1.
So finally it will be : ((1) +(1)) = 2
Note: == operator returns boolean when values are compared.
Hope this helped you.
+ 1
In computer language Boolean has their own values like true = 1 and False = 0 so as both are true 1+1 is 2
0
Mjahda