Lesson 3 Functions, i need help


#1

I need help in Lesson 3 I do not understand and I can not go ...
I need urgent help

def square():
"""Retorna o quadrado de um numero."""
squared = n**2
print "%d squared is %d." % (n, squared)
return squared

def square(10):
"""Retorna o quadrado de um numero."""
squared = 10**2
print "%d squared is %d." % (10, squared)
return squared

what is wrong here?


#2

n is not defined. It should be in the parameter.

def square(n):

Do the instructions ask us to print the value before returning?

    return n ** 2

or, perhaps?

    return "%d squared is %d." % (n, n ** 2)

#3

I don't get what you say! i've tried the whole ways and it doesn't work

def square(10):

what do I go wrong?


#4

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