Call and Response


#1



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


File "python", line 9
def square(10):
^
SyntaxError: invalid syntax

How do I call the function correctly?


def square(n):
    """Returns the square of a number."""
    squared = n**2
    print "%d squared is %d." % (n, squared)
    return squared
    
# Call the square function on line 9! Make sure to
# include the number 10 between the parentheses.
def square (10):


#2

Were you trying to define the function here again on line 9? That's where the error is pointing at.

All you need do is call it, as in the comment.

square(10)

#3

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