Practice Makes Perfect help


by_three(1) returned 1 instead of False
I dont understand what i am doing wrong please help

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


When this is non-zero, it will be true in the if condition, but number is not divisible by 3. Switch your two return statements around and it will work correctly..


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