+ 3
What is the output of this code in python?
a= 5.0 b= 5+0j print(a==b)
7 Answers
+ 6
To answer this kind of question nxt time you can copy/paste to playground.
Interesting that it ignored the j.
+ 6
j is root -1,
5 + 0j is Complex number, no imaginary part
5.0 is Float without decimal part.
So both are 5, so returns boolean True
https://code.sololearn.com/c4MIwbumEsPt/?ref=app
+ 5
Gordon Interestng!
+ 3
True
+ 1
And one more interesting fact is
If you try with
a= 10
b= 10.0
Print(a==b)
The result will be true only
Note: Other programming language like java,c++ won't return true
0
Perfect explain Gordan
That's what I'm expecting
0
True + 0j đ