6/19 Please HELP


ok, so I did complete the lesson as you might have seen below. But I just don't understand why in the if the number divided by 3 is equal to 0. I just don't get why that needs to happen. Because if I decide to put 12 as the number and divide it by 3 it is 4. And I'm pretty sure 4 isnt equal to 0 so I just don't get it please help thank you

These are the instructions given:
First, def a function called cube that takes an argument called number. Don't forget the parentheses and the colon!
Make that function return the cube of that number (i.e. that number multiplied by itself and multiplied by itself once again).
Define a second function called by_three that takes an argument called number.
if that number is divisible by 3, by_three should call cube(number) and return its result. Otherwise, by_three should return False.
Don't forget that if and else statements need a : at the end of that line!

Replace this line with your code. 
def cube(number):
    return number **3
def by_three(number):
    if number % 3 == 0:
        return cube(number)
        return False


It is divided by 3, yes, but the value yielded is the remainder, not the quotient.

6 / 3 == 2, 0 remainder. so, 6 % 3  == 0


I copied your code in my console and it told me it was correct.It might be a problem with your browser.If you are using Chrome,you might have some problems.I usually use Chrome,but now I'm using Firefox and had no problem introducing your code.


nonononono yes my code is correct, I was just asking why because I didn't understand something


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