Practice Makes Perfect, is_int



is this bug or did I do the task perfectly.

3rd lesson --> is_int (please read the task first. )

define a function for int(), i do this:

def is_int(x):
  if x == int(x):
    return True
    return False

when i hit ‘Run’ , he said my job was correct. but when I reset the task and asked for a solution, I got this:

def is_int(x):
  absolute = abs(x)
  rounded = round(absolute)
  return absolute - rounded == 0

Is this a bug when it showed me that is true, but is not it really true?


There can be multiple ways to solve the problem, yours is correct as well.


oooooouuuu yea :smiley: I’m a genius lol :rofl: