Functions: Call and response help


File "python", line 9
IndentationError: unindent does not match any outer indentation level

Oops, try again. Your code looks a bit off. Check the Hint if you need help! Your code threw the following error: unindent does not match any outer indentation level (python, line 9)

I expected it to return the square of 10. I tried several different things but the code above is just the one I choose to submit. I don't understand what the instructions are asking me to do.

Replace this line with your code. 

    """Returns the square of 10"""
    squared = 10**2
    print "%d squared is %d." (10, squared)
    return squared


Square(10) should be a function.

def square():

Replace the 10 in your argument with a variable n, and do that wherever you have 10 written.

def square(n):

Then you need to call your function at the end of your code.


This way the code will work with any number, I can call square(985883740) at the end of the code and have it print it.


thanks for your help but unfortunately I'm still stuck.

I tried replacing the 10s in my code with n but it looks just like the sample code and the error message says that I didn't call square(10) on line 9

Where do I call square(10) in the code


def square(n):
    """Returns the square of a number."""
    squared = n**2
    print "%d squared is %d." % (n, squared)
    return squared

The last line, square(10), executes(calls) the function.


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