Practice Makes Perfect, is_int


#1

Aloha,

is this bug or did I do the task perfectly.

3rd lesson --> is_int (please read the task first. https://www.codecademy.com/courses/learn-python/lessons/practice-makes-perfect/exercises/isint?action=resume_content_item )

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

def is_int(x):
  if x == int(x):
    return True
  else:
    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?


#2

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


#3

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