6/19 can u he.p whats wrong


#1

def cube(number):
return number**3

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


#2

Question is are you supposed to return True/False?

If not might be your issue other than that should work as designed.

I think you have to return False if it doen not and the number if it does,

Example:

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

#3

First, def a function called cube that takes an argument called number. Don't forget the parentheses and the colon!
Make that function return the cube of that number (i.e. that number multiplied by itself and multiplied by itself once again).
Define a second function called by_three that takes an argument called number.
if that number is divisible by 3, by_three should call cube(number) and return its result. Otherwise, by_three should return False.


#4

4. if that number is divisible by 3, by_three should call cube(number)

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

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

You will have to call the cube(number) function if number is divisible by 3.

Regards.


#5

Here is my code :
def cube(number):
return number**3

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

In the sixth line, I got an error that says "IndentationError: expected an indented block" in the "return"

What is the problem ?


#6

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


#7

This may help :wink:

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