3/19


#1

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


#2

I think that you're completely misunderstanding something about functions here. First you define a function with an argument (x in this case).

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

Then you call the function with any value you want as the input.

square(2)
square(10)
square(33.33)

This lets you reuse the code in the function instead of writing it over and over again with different values.


#3

Once you changed n to 10, you blew up your formula. You create the formula as a repeatable process, and then add the value of n later.

def square(n):
    squared = n**2
    print "%d squared is %d." % (n, squared)
    return squared

#this is what you missed. 
square(10)

#4

the answer is easy only write
square(10) and it will work