Here's the question you clicked on:
danmei
Can someone tell me what is wrong with this code? It is Codecademy review of functions. The error states that it is not returning an absolute value for integers, and I presume floats too.... def distance_from_zero(x): first = type(x) if first == "int": return abs(x) elif first == "float": return abs(x) else: return "This isn't an integer or a float!"
when you put "if first == "int": you're comparing with a string: 'int', for type just use: if fist == int: you would see the int in purple I think
Thanks, that did it. I really appreciate waking up to an answer!