Is_int problem


Hi, it is really not complex but I'm not sure how to use the 'round()' function nor the 'math.floor' one.
what is wrong?

Practice Makes Perfect:is_int

Replace this line with your code. 

def is_int(x):
    if round(x)-x==0:
        return True


With a google search
round() site:
you will find

Python provides a round function for rounding a float to the nearest integer. 
For tie-breaking, versions before 3 use round-away-from-zero:
    round(0.5) is 1.0, round(-0.5) is −1.0.[70] 
Python 3 uses round-to-even: round(1.5) is 2, round(2.5) is 2.

OR google search
round() site:

round(number[, ndigits])
Return the floating point value number
 rounded to ndigits digits after the decimal point. 
If ndigits is omitted, it defaults to zero. 
The result is a floating point number.
 Values are rounded to 
the closest multiple of 10 to the power minus ndigits; 
if two multiples are equally close,
 rounding is done away from 0 
(so, for example, round(0.5) is 1.0 and round(-0.5) is -1.0).

 The behavior of round() for floats can be surprising: for example,
 round(2.675, 2) gives 2.67 instead of the expected 2.68.
 This is not a bug: 
    it’s a result of the fact that most decimal fractions 
   can’t be represented exactly as a float. 
 See Floating Point Arithmetic: 
      Issues and Limitations for more information.

floor() site:

Return the floor of x as a float, 
the largest integer value less than or equal to x


nice to know

You could test in
choose Python
You will get a split-screen
In the left-hand-side you paste-in your code
click on the Run button.
The right-hand-side is the console

== the code==

import math

x= 2.65
print math.floor(x)
print round(x,1)