19. Review: Built-in functions 19/19


#1

Can anyone give me some tips? I inserted my code (as shown below) and it cleared the interaction.
I was just wondering if this is a correct way of doing what was asked in the instructions? Or what would have been the best way?

def distance_from_zero(z):
return abs((type(z) != int) or (type(z) != float))
def abs(z):
return “Nope”


#2

Test the types first, then return the absolute value if it is a number.

if type(z) == int or type(z) == float:
    return abs(z)

#3

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