Practice Makes Perfect


#1

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

this is my code, and it always output "NONE", but shouldn't the "by_three(3)" result 27? 
anyhelp will be appreciated, thank you~

Replace this line with your code.


#2

This looks like it is still in the function block. Remove indentation.


#3

2 posts were split to a new topic: Practice makes perfect


#4

A post was merged into an existing topic: Practice makes perfect


#6

You don't have any print commands so it won't display the outouts.


#7