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


working of boolean why am i getting false for 7 th line and true for 8th line

3/31/2020 11:41:02 AM


5 Answers

New Answer


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


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


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.


Thanks. It was so helpful


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