Completely lost


#1

Hello,
I receive the error cube(1) returned 3 instead of 1

I honestly am completely lost and do not know whats going on or what I need to do.


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


#2

instead of raising 3 to the power of number you need to raise number to the power of 3! :smiley:


#3

I tried
def cube(number):
return number**3

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

and it give me Oops, try again. by_three(1) returned 1 instead of False


#4

So you have two problems here.

First, you want your number to be divisible by 3 and have a remainder equal to 0.

Secondly, you don't want to just return the number by itself but as step 3 points out, "if that number is divisible by 3, by_three should call cube(number)"


#5

here's a hint ... you are using the right mathematical symbol, but it doesn't do what it looks like you think it does


#6

Put this in and think I got it.

def cube(number):
return number**3

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


#7

Yep you got it! Good job! :smiley:


#8

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