U gotta check out this.. the last statement is True? How? It should be false instead | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

U gotta check out this.. the last statement is True? How? It should be false instead

'a' has 5 stored in it and 'b' has 3 so how can 5==3 can give true? https://code.sololearn.com/c3jcg20yXB93/?ref=app

10th Jun 2019, 3:21 PM
Mohd Adnan khan
Mohd Adnan khan - avatar
6 Answers
+ 6
The equal operator (==) is evaluated before the assignment operator (=). 5 == 3+2 # True a = 5 == 3+2 # a == True 3 == 3 # True b = 3 == 3 # b == True a == b # True c = a == b # c == True
10th Jun 2019, 3:30 PM
Diego
Diego - avatar
+ 6
Ohh thanks buddy 🙂... Now I come to understand that 'a' has True value not 5 and similarly 'b' has true value not 3...💡
10th Jun 2019, 3:32 PM
Mohd Adnan khan
Mohd Adnan khan - avatar
+ 5
a doesn't have 5 stored in it, but 5==3+2 (= True). b=3==3 is also True. True == True is True
10th Jun 2019, 3:32 PM
Anna
Anna - avatar
+ 5
Run it like this, you will see both I'd and type for a and b are the same: my_boolean = True print(my_boolean) print(2 == 3) print("hello" == "hello") a=5==3+2 b=3==3 c=a==b print(id(a)) print(id(b)) print(type(a)) print(type(b)) print(c)
10th Jun 2019, 3:41 PM
Paul
Paul - avatar
+ 2
What this I'd is? Can u explain it to me?
10th Jun 2019, 3:58 PM
Mohd Adnan khan
Mohd Adnan khan - avatar
0
What is this "a and b value is not equal" But it's says true how it is
23rd Jun 2019, 1:14 PM
Anil kumar
Anil kumar - avatar