6. practice makes perfect help


I think I am doing it right but i am getting an error.


I get error message "Oops, try again. by_three(3) returned None, did you remember to return the result?"

I expect it to work, but it doesn't.

def cube(number):
    return number**3
def by_three(number):
    if (number % 3 == 0):
        return False


There are paths that your by_three function can take which does not come across a return statement, and therefore not return anything (see your error message)


So what should i do to fix it?
should i use a raw_input


You'd need to argue for why that would help.

As said earlier, the problem is that your function does not always return a value, the solution to that is to consider all things that your function might do and make sure that in all those cases it's going to return something


so i just did this one, what you are missing is a return after your if. since its what the class is asking you for.


Thanks to everyone especially jole80 i solved my problem and can move on now


Thanks a lot for your help


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