Help!


#1

I'm in Functions 6. Practice makes perfect.
https://www.codecademy.com/en/courses/python-beginner-c7VZg/1/5?curriculum_id=4f89dab3d788890003000096#

I need help, the error is:

Oops, try again. by_three(1) returned 'number is not' instead of False

My code is:

def cube(number):
return number**3
print number
def by_three(number):
if number % 3 == 0:
return "number is divisible by 3"
return True
else:
return "number is not"
return False
cube(2)


#2

a function ends the moment a return keyword is reached, because you return strings before the boolean values, the boolean values are never reached


#3

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