I'm confused...can someone help me?



Oops, try again. by_three(3) returned instead of 27

Anyone know what I'm doing wrong with my code? :confused:

n = raw_input("Please enter a number")

def cube(n):
    cube = n**3
    return cube

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


The return statement in that should be:

return cube(number)


Ah, ok. It works now. Thanks!


Wlecome! :slight_smile: Glad to help.


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