+ 2

Why it is returning True ,can anyone explain?

print(1 == 1.0) #true print(type(1)) #int print(type(1.0)) # float Why 1 == 1.0 is returning true in here ,as we can clearly see in here that 1 is of type int and 1.0 is type of float and yes if I'm not wrong == compare values only(is it ignoring the decimal ??) and === compare values and data type at the same time , anyone can please explain me this why 1 == 1.0 is returning true ?

27th Feb 2020, 4:43 PM
ayushman tiwari
ayushman tiwari - avatar
2 Respuestas
0
Got it , thanks 😊
27th Feb 2020, 5:05 PM
ayushman tiwari
ayushman tiwari - avatar