0
why print("2"+"5"==5*5) is false?
3 Antworten
+ 6
The left-hand term is "25", which is a string, while the right-hand term is 25, which is an int.
+ 1
The correct setence is ("2"+"5"==str(5*5))
0
When you evaluate "25" with 25 you are for sure going to get a false value. Because "2"+"5" is a string value, whereas 5*5(25) is an int value. If you compare int with string then it will obviously end up in False result. Hence write str before 5*5, i.e. print ("2" + "5" == str(5*%)), now here, both the values are string. Ans thus produces True