Lesson 6. Practice Makes Perfect HELP


#1



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


I'm getting the error "Oops, try again. by_three(1) resulted in an error: unsupported operand type(s) for %: 'function' and 'int'"

I'm not sure what's happening here. It's acting like division is not supported


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

EDIT Solved! I was trying to divide the integer instead of the parameter. Got it now!


#2

The name of the function (function is not a number) cannot be evaluated. Use the parameter, not the function name and this will work.


#3

I got it, haha. I posted an edit :slight_smile:


#4

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