Practice make perfect


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

see when i run this code even when the number is not divisible by 3 it performs the action cube(number) instead of printing false ?? anybody ??


#2

Are you sure, that you are calling a correct function?


#3

should i call by_three(50) ??


#4

Yep. If you want it first to verify if number given is divisible by 3 then there's no other option


#5

yehhh
thanks man.. it worked :smile: