Hi, I have a problem with this Python code


#1

I am trying to define a function in section 6 : Functions

This is my code:
but the results always gives me back an error: "cubo(1) gives back instead 1"

def cubo(n):
cubic = n ** 3
print "el cubo de %s es %s" % (n, cubic)
return cubo

def por_tres(n):
if n % 3 == 0:
cubo(n)
print "%s es divisible por 3" % (n)
return cubo
else:
print "%s no lo es" % (n)

por_tres(1)


#2
def cubo(n):
    cubic = n ** 3
    print "el cubo de %s es %s" % (n, cubic)
    #return cubic

def por_tres(n):
    if n % 3 == 0:
       cubo(n)
       print "%s es divisible por 3" % (n)
       #return cubo
    else:
       print "%s no lo es" % (n)

por_tres(1)
por_tres(2)
por_tres(3)

==>OUTPUT

1 no lo es
2 no lo es
el cubo de 3 es 27
3 es divisible por 3