Practice Makes Perfect-Syntax Error


#1

https://www.codecademy.com/en/courses/python-beginner-c7VZg/1/5?curriculum_id=4f89dab3d788890003000096

In the "Practice Makes Perfect" exercise of the Functions section I submitted the following:

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

and received the error message:

File "python", line 4
if number % 3 == 0
^
SyntaxError: invalid syntax

I cannot understand what is wrong with my syntax, any help is very much appreciated.


#2

I would recommend that you use markdowns so we can tell how it looks on your end. I imagine this is how it looks for you:

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

If it is, take a close look at your indentations. When are indentations used?


#3

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