+ 4
What is output a=5==2+3; b=2==2; c=a==b; print(c)
I think it's output is False but in the ans where I was doing this problem given TRUE. Can someone please explain it to me.
21 Réponses
+ 3
In the line 1:
a=5==2+3
Right side the condition will be TRUE ie, 5==2+3 => 5==5
Therefore a=TRUE
In the line 2:
b=2==2
Same as above right side condition will be TRUE ie, 2==2
Therefore b gets value TRUE
b=TRUE
In line 3:
c=a==b
from line 1 and 2. a=TRUE,b=TRUE so a==b=TRUE
Therefore c gets a value TRUE
c=TRUE
Therefore result is TRUE
+ 3
it’s true
+ 3
Thanks Shobhith J B 𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 got the ans.
+ 2
Mohini Yadav
I explain: first the variable name is entered, the bool value of which needs to be found, then the assignment sign "=", which assigns the value of the bool type to this variable, then the condition is checked, for example, the value 5 is 2 + 3 or not? If equal, then a variable of type bool is set to True, if not-False ...
+ 2
A is if 5 equals 3+2 which is true.
B is if 2 equals 2 which is true.
C is if A & B are both true or both false and here they are both true so c is true
+ 2
Granger it's okay :)
+ 1
Yeah, I agree that while I was typing this code couldn't find the enter option so was not able to write code properly. Sorry for the inconveniences.
+ 1
Since
a=5==2+3;
Which is True
b=2==2 ;
Which is True
c=a==b;
Since c is equal to a and b
But a is 5 and b is 2
So I think the answer is False
Because,in this case a!=b
Hope am right?
+ 1
It's true
Because,a and b both are true
0
Copy paste mistake
0
run it
a=5==2+3;
b=2==2;
c=a==b;
print(c)
0
a = True, because 5 == 2 + 3.
b = True, because 2 == 2.
c = True, because True(a) == True(b).
Output: True.
Working with Boleans variables.
UPD: Sololearn lesson -- https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2279/