Practice makes perfect


#1



Replace this line with your code.


La practica hace al maestro - funciones 6
#2

Please paste our code into your post.


#3

and i get this error;
Oops, try again.
by_three(1) returned None, did you remember to return the result?

can anyone help out??


#4

You have to return false, you are just printing.


#6

Amigos debemos tomar en cuenta que cuando se nos dan las instrucciones tratar de resolver estas como se piden, pues no se si es falla de la pagina o es que así mismo al darte como resultado aprobado la lección esta es valida; lo real es que en esta lección ella pide que se devuelva el "resultado" tratemos de resolver cada lección como se debe, e aquí la solución correcta... Saludos...

def cubo(numero):
return numero**3

def por_tres(numero):
if numero % 3 == 0:
print cubo(numero)
return cubo(numero)

else: 
    return False

cubo(3)
por_tres(15)


#7

def cube(n):
return n ** 3
def by_three(n):
if n % 3 == 0:
return cube(n)
else:
return "False"
by_three(9)

i don't get why this doesn't work


#8

my code is:
def cube(number):
cube = number**3
return cube
def by_three(number):
if number%3 == 0:
return cube
else:
return False
but when I use it the interpreter says:
Oops, try again. by_three(3) returned instead of 27


#9

I got this:
def cube (n):
return n ** 3

def by_three (n):
if n % 3 == 0:
return cube(n)
else:
return False

what do you think of it?


#10

If you put False in " " it is a string and not a boolean. But you want to have a boolean. Simply remove the " " and --> return False

def cube(n):
return n**3

def by_three(n):
if n % 3 == 0:
return cube(n)
else:
return False

by_three(9)


#11

Sorry for the late reply. That seems right though. I thanks


#12

Why the "== 0"-part?¨
Shouldn't it be enough with "n % 3"?