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:


#4

@stetim94 i also do the same and the same problem occurs , whats the reason behind this?


#5

you violated the guidelines by hijacking an existing topic rather then creating your own topic.

same problem is referring to something non-existing, pax37 just wanted conformation his solution was also correct. You provide no code and no error message, so impossible to say what you problem is


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.