 What is output a=5==2+3; b=2==2; c=a==b; print(c) | SoloLearn: Learn to code for FREE!

+3

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

+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

Thanks Shobhith J B 𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 got the ans.

+2

Mohini Yadav Why do you think that it will be False?

+2

+2

Granger in python 3 you can type multiple statements in one line separated by semicolon without causing error.

+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

+1

Granger Values of a,b,c are correct ,read it again Only syntax is wrong, which can be ignored as Python3 is mentioned in tags

+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

Mohini Yadav, I understood, I myself didn’t understand the syntax because of the text without a spaces)))

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

0

Here even the syntax is incorrect, how can we talk about the conclusion? And in general, what is equal to a, what is equal to b, what is equal to c, you just threw off it is unclear what you ask, what conclusion

0

0

𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥, I tried to run the code, it didn’t work, I wouldn’t just say that, but okay.)

0

run it a=5==2+3; b=2==2; c=a==b; print(c)

0

𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥, Only now I realized what all that is written in the question means ... But, agree, it is not clear ...

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/Python/2279/