6/19 - how do i make it return if or else result?


#1
def cube(number):
    return number * number * number 
    
def by_three(number):
    if number % 3 == 0:
        return cube(number)
    else:
        return False

This code passes but the result is only "none" and not cube of number or false. I tried raw_input, input() in all possible places but it won't work. Even if i try to put number = 3 it won't work. Any other method? Am i missing something?


Got Ya!
#2

If you want to see the number cubed, you need to use print instead.


#3

No, the function should not print anything.
Instead call the function and print the result


#4

print by_three(x)?


#5

...but how? don't you still use print? code by jibblyj works.