Why is 2.0==2 True even though 2.0 is float and 2 is int?
print(2.0==2)
output:
True
Why is 2.0==2 True even though 2.0 is float and 2 is int?
print(2.0==2)
output:
True
Well, 2.0 is just a decimal representation of 2, so 2.0 = 2. If, however, we are dealing with strings, then '2.0' != '2'. I hope that helps.