Call and Response


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):


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.



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