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


#1



https://www.codecademy.com/en/courses/python-beginner-c7VZg/1/5?curriculum_id=4f89dab3d788890003000096#

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
      else:
            return False

cube(3)
by_three(1)


#2

Check the hint

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

```
if number % 3 == 0:

#3

Try this
else:
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)


#5

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