working of boolean | Sololearn: Learn to code for FREE!

0

working of boolean

https://code.sololearn.com/c8RXGEykh672/# why am i getting false for 7 th line and true for 8th line

3/31/2020 11:41:02 AM

Mani

5 Answers

New Answer

+3

Because the value of x is String. If you do like this int(x) == y then you will get true. so here x = "4" + "5" = "45" y = 4 * 5 = 45 ("45" == 45) = false because you are Comparing String with number. (int("45") == 45) = true

+2

Because one is string type and another is integer type.in line eight you enter ! which means not.so in line eight code says that str is not equal to integer,thats why output is false...

+1

Add this after line 5 to see that both of them belong to different class types. print(type(x)) print(type(y)) x is string. y is integer.

0

Thanks. It was so helpful

0

value of x is "45" which is string And y is 45 which is int string is not equal to interger