Please help me with this Python function, can't figure out what I'm doing wrong


It says it is returning 1 instead of False

It is supposed to return the cube of a number or return false if not divisible by 3

def cube(number):
    return number**3
def by_three(number):
    if  number % 3:
        return cube(number)
        return False



I feel like it is a simple typo error or something else similar. Most likely something obvious that I missed.



if  number % 3:

you should check if the remainder is zero (equals zero), you don't do this


Please explain by what you mean by remainder.


the modulo (%) calculates the remainder, you should check if it equals zero:

if  number % 3  # check if it equals zero here


Thank You, that seemed to work