Seams to work but says its wrong


Oops, try again. by_three(4) returned 64 instead of False

if I put a number that is divisible by three it should call cube and cube that number. if not divisible by three it should return false

def cube(number):
  number = number**3
def by_three(number):
    if number / 3:
        return cube(number)
        return False
answer = by_three(1)



    if number / 3:

how does this determine is number is divisble by 3?


In your if statement, you have code that says if number / 3. It does not provide an actual condition. You're actual code should read:

If number % 3 == 0:

This way, the computer is able to check if the number is evenly divisible by three.


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