What's wrong with my code? I think it's all rigth


#1




What's wrong with this code? Python returns error:

Oops, try again. Your function seems to fail on input True when it returned 'None' instead of 'Nope'


Code is:


def distance_from_zero(liczba):
    if type(liczba) == int or type(liczba) == float:
        return abs(liczba)
    else:
        print "Nope" 

!!! SORRY I'VE FOUND IT - return instead of print. 
Thanks anyway


#3

Oops you got it. I'm always too slow. :grin:


#4

Thanx anyway. It's good to know that you can count on somebody if you are in trouble.


#5

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