Practice Makes Perfect - Stuck


#1



number = raw_input("Enter a number:")
    
def cube(number):
    return number ** 3
    
def by_three(number):
    if (number % 3 == 0):
        print "This number is divisible by 3."
        return cube(number)
    else:
        def by_three(number):
            return False
            print "This number is not divisible by 3."

Oops, try again. by_three(1) returned None, did you remember to return the result?

Need help.


#2

why do you create another function in your else clause?


#3

Your function is already defined, so we would not define it again, and especially not inside the same function.

Anything after return is not reachable. If you wish to print, then it should be before the return.

Not sure about this lesson. Does it ask us to print anything in the function?


#4

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