Practice Makes Perfect


#1



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


When I run my code, it says this: Oops, try again. by_three(3) returned False instead of 27. Why is this happening with my code?


I expect the code to turn up as it divisible by three and the code to be accepted.


def cube(number):
    return number**3
def by_three(number):
    if number/3 == int:
        return cube(number)
    else:
        return False


#2

>>> 3/3 == int
False
>>> 3/3 == float
False
>>>

Suggest using modulo % and test for zero remainder.


#3

It works! Thank you.


#6