+ 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

29th Nov 2020, 2:07 PM
Danayt Girmay Gebreselassie
Danayt Girmay Gebreselassie - avatar
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
29th Nov 2020, 2:14 PM
Arsenic
Arsenic - avatar
+ 3
Ohhhhh ok thank you guys✌🙂
29th Nov 2020, 2:18 PM
Danayt Girmay Gebreselassie
Danayt Girmay Gebreselassie - avatar
+ 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😊
29th Nov 2020, 3:35 PM
Anjali Sahu
Anjali Sahu - avatar
+ 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.
1st Dec 2020, 9:46 AM
Dr£@M_c@tcH£r
Dr£@M_c@tcH£r - avatar
+ 1
In computer language Boolean has their own values like true = 1 and False = 0 so as both are true 1+1 is 2
30th Nov 2020, 8:00 AM
Sayyam Jain
Sayyam Jain - avatar
0
Mjahda
30th Nov 2020, 10:01 AM
Mjahda