19.Review Need help


#1



Replace this line with your code. 
def distance_from_zero(ca): 
    ca == raw_input()
    
    if type(ca) == int or float:
        return abs(ca)
    else:
        return "Nope"


#2

Do the instructions ask us to get user input inside the function? I think not.


#3

Thanks for replying. I find the problem is "or".

def distance_from_zero(ca):
ca == raw_input()

if type(ca) == int or type(ca) ==float:
    return abs(ca)
else:
    return "Nope"

I have fixed it.


#4

The above line does not belong. Please remove it.


#5

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