0
Can we compare two data types such as an integer and a float and what Boolean value will I get?
2 Antworten
+ 7
In Python? Yes!
print(3.6 > 3) -> True
print(5.4 > 6) -> False
print(6.0 == 6) -> True
+ 1
You probably can, if the `float` variable only has zero past decimal separator. I don't think it's a good idea otherwise.
Why you wanna compare integer to a floating point type though? they are different by nature.