I don't know what's wrong


#1

Continuing the discussion from 6. Practice makes perfect, answer?:

This is my code

def cube(number):
cubed = number**3
return cubed

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

and this is my error message

by_three(1) resulted in an error: unsupported operand type(s) for %: 'function' and 'int'

suggestions anyone?


#2

@trisharue00

It is quite specific in your error code what is going down.

Still need help, ask agian.


#3

@trisharue00
The issue is in your code when your trying to call by_three in side your by_three function .

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

since by_three( the one inside your function) doesn't have any value it can't give you the Modulus ( % ) of 3.

instead you should replace by_three by number , like so:

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

Hope it helps.