Float and modulo


#1

Question for you. What does

float(x) % 1

do?


3/15 is_int please my code work?
#2

It returns the decimal fraction portion of the float.

3.14 % 1 == 0.14

So if the output is 0, then the number is an integer, or a float with no decimal fraction.

3.0 % 1 == 0    # True

3 % 1 == 0      # True

#3

It was a rhetorical question in response to this thread: 3/15 is_int please my code work?

Please move it back! :slight_smile:


#4