6. Practise Make Perfect - the invisible problem ;)


#1

please help because it's driving my crazy ... I looked at all the questions in this forum and ..... still nothing. PLEASE.

def cube(number):
 return number**3 
 
 def by_three(number):
    if number % 3 == 0:
    print cube(number)
else:
    print False

I've tried add a tab or remove a tab. And the codeacademy has a problem anyway ....
This is the error in the console window... :

File "python", line 2
return number**3
^
IndentationError: expected an indented block


#2

I've corrected that and now ..

def cube(number):
    return number**3 
 
def by_three(number):
    if number % 3 == 0:
        print cube(number)
    else:
        print False

The error is : Oops, try again. by_three(1) returned None, did you remember to return the result?

.................. :frowning:


#3

In your by_three function you have to return something but you printed
use return keyword


#4

Well, sometimes reading the error can help, in this case you were just told to return the result of by_three.


#5

What a stupid mistake ... THANKS !


#6

I cannot do this exercise. Can someone help me understand the structure to solve it and why I am doing certain things?


#7

#8

please make a new topic, fill in the template so we can see how much progress you made, thank you :slight_smile: