Help w/ Practice makes perfect 6/15


#1

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

I cant seem to figure out whats wrong please help.


#2

this line:

return number**3

seems to be indented incorrectly, can you provide the exercise url if you are still stuck?


#3

didnt quite seem to work here is the url https://www.codecademy.com/courses/python-beginner-c7VZg/1/5?curriculum_id=4f89dab3d788890003000096


#4

are you sure? the indention of that line is the only thing that is wrong, can you please post an updated version of your code? please use markup:

this will ensure that the forum shows the indent as it is in your code


#5

here is my new code, which still isnt working

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

#6

it wont show the indents i added :neutral_face:


#7

i provided you with a topic how to show indent on the forum? now the indent inside your by_three function is off, the if and else should be indented, an example of a if/else in a function:

def example():
    if True:
        print True
    else:
        print False

#8

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