0

how is the output of print (2==2.0) true ?

24th Aug 2020, 3:49 PM
Prateek Arora
Prateek Arora - avatar
2 odpowiedzi
+ 5
The result is True. This is something you can check easily by yourself by using the python console or the playground. You compare the int value 2 with the float value 2.0. Both are 2, so the result is True.
24th Aug 2020, 3:55 PM
Lothar
Lothar - avatar
+ 1
How not? It is better to add reason... Equality operand compares here content only..... 2, 2.0 are not same value? Pls tag the language?
24th Aug 2020, 3:53 PM
Jayakrishna 🇮🇳