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


#1

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

cube(2)

#2

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


#3

here:

if  number % 3:

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


#4

Please explain by what you mean by remainder.


#5

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

if  number % 3  # check if it equals zero here

#6

Thank You, that seemed to work


#7