Error in chapter 6 functions


#1




returned 'False' instead of False


Replace this line with your code. 
def cube(number):
    return number*number*number
    
def by_three(number):
    
 if number%3==0:
    cube(number)
 else:
    return  "False"


#2

by_three is a function, so it should return the cube number of number- parameter instad of calling to it.


#3

Here is the code I used that worked:

def cube(number):
return number ** 3

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

cube(3)


#4

use this code

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


#5

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