0
basic
can we compare fractional and integer by using > symbol?
3 Antworten
+ 5
Do you mean like this?
x = 1/3
y = 1
print(x > y)
print(y > x)
+ 2
if this is what you mean, please keep in mind that a computer can’t do fractions.
1/3 is not a proper fraction for a computer only a float to a certain amount of numbers behind the decimal point. so it is not 1/3 but instead 0,3333333333333333333333333333 etc
this has implications for your results and also when using round, ceil, floor etc
+ 2
Brave Tea Good point, glad you raised it. 👍