19/19 Seems right but says "returned '1' instead of "nope"


#1
def function_from_zero(sam):
  if type(sam) == int or type(sam) == float:
    return abs(sam)
  else:
    return 'Nope'

#2

why should it return nope? There never is a function call, so the function never executes. The exercise might call the function for validation purpose.


#3

Not sure, that’s what the error was. I gave up and selected ‘Get Code’ and it gave me the exact code i wrote except the argument was ‘num’ instead of ‘sam’


#4

that is very unlikely, do still have the faulty code?

Ah, that was the error message, i see.


#5

I think the exercise calls the function “distance_from_zero” whereas your function is “function_from_zero”? Just a guess.


#6

The function name needs to be a match, so that would explain it. Nice catch :slight_smile:


#7

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