19. Review: Built-In Functions


This is my code

def distance_from_zero(number):
number = 25
if type(number) != int or type(number) != float:
return abs(number)

This is the error

Oops, try again. Your function seems to fail on input -10 when it returned '25' instead of '10'

Help please someone give me the answer I have been stuck on this for a week!


Why do you think that your function is returning 25 when you give it -10? How could that happen?


You defined all numbers as 25, but the program wants you to learn how to do generic functions

import math

def distance_from_zero(n):
if type(n)== int or type(n)== float:
return abs(n)

    return "Nope"