Practice Makes Perfect - "What is wrong with this code?"


Can someone please tell me what is wrong with this code?

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

It prints this error:

File "python", line 6
SyntaxError: invalid syntax

Any idea why?


the indention of else is wrong, it should be an if/else so if and else should be at the same indent level


Thanks, that had me confused for a while!