My code won't work, even though I try to fix it


For the error messages, it keeps saying "by_three(2) returned 2 instead of False.

I expect my code to work, or the error message to change when I tweek my code, or call upon a different number for the function by_three.

def cube(number):
      return number ** 3

def by_three(number):
      if cube(number)/3:
            return cube(number)/3
            return False



Check the hint

your if statement will never return False since you didnt set a relational operators

if number % 3 == 0:


Try this
print "False"
return False

Also, delete cube(3) and use by_three only to check your code.

On the return statement for by_three, it should look like return cube(number)


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