Why true false? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why true false?

2==2.0 2 is 2.0

16th Oct 2020, 6:38 PM
Curious Ant
Curious Ant - avatar
4 Answers
+ 2
Is checks if object a IS object b. == checks if it is similar. 'Hey, that woman over there looks like your mom!' 'Ah, well, very strange indeed.' (==, woman looks the same, but isn't the same woman) or: 'Oh, wow, that IS my mom! What's she doing here?!'
16th Oct 2020, 9:35 PM
HonFu
HonFu - avatar
+ 1
2==2.0, but type(2)-int, type(2.0)-float and int != float
16th Oct 2020, 6:41 PM
[][]
0
so “is” is actually comparing the data types ?
16th Oct 2020, 6:42 PM
Curious Ant
Curious Ant - avatar