+ 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.

7th Jul 2020, 1:13 PM
Mohini Yadav
Mohini Yadav - avatar
21 Respostas
+ 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
7th Jul 2020, 1:58 PM
Shobhith J B
Shobhith J B - avatar
+ 3
it’s true
8th Jul 2020, 6:24 AM
Jeremy Cheung
Jeremy Cheung - avatar
8th Jul 2020, 5:22 PM
Mohini Yadav
Mohini Yadav - avatar
+ 2
Granger in python 3 you can type multiple statements in one line separated by semicolon without causing error.
8th Jul 2020, 6:09 PM
Mohini Yadav
Mohini Yadav - avatar
+ 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 ...
8th Jul 2020, 7:27 PM
Лебедев Игорь
Лебедев Игорь - avatar
+ 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
8th Jul 2020, 8:32 PM
שקד אסרף
+ 2
Granger it's okay :)
9th Jul 2020, 7:15 AM
Mohini Yadav
Mohini Yadav - avatar
+ 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.
8th Jul 2020, 5:21 PM
Mohini Yadav
Mohini Yadav - avatar
+ 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?
9th Jul 2020, 8:50 AM
💖Mosunmola💖🥂🥂
💖Mosunmola💖🥂🥂 - avatar
+ 1
It's true Because,a and b both are true
18th Jul 2020, 6:19 AM
Abdullah Al Rafi
Abdullah Al Rafi - avatar
0
Copy paste mistake
7th Jul 2020, 2:11 PM
Shobhith J B
Shobhith J B - avatar
0
run it a=5==2+3; b=2==2; c=a==b; print(c)
8th Jul 2020, 6:25 AM
Jeremy Cheung
Jeremy Cheung - avatar
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/
8th Jul 2020, 10:20 PM
Ayozav
Ayozav - avatar