Function 6. Practice makes perfect


#1



I need help with this lesson in the Functions session of Python. I cannot figure out what is going wrong, it may be something very stupid. I'm prone to making silly errors so if anyone could help me out it would be much appreciated :smiley:

https://www.codecademy.com/courses/python-beginner-c7VZg/1/5?curriculum_id=4f89dab3d788890003000096#

Oops, try again. by_three(1) returned 1 instead of False


def cube(number):
     return number**3

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


#2

Consider that the only quotient equal to zero is division into zero.

0 / n == 0    n != 0

and division by n is not evidence of divisibility. The remainder serves that role.

number % 3 == 0

#3

No way!!! Haha thanks!! That makes sense too because no number divided by another will be zero, other than zero.


#4

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