6. 'Practice Makes Perfect'


#1



Having some trouble, would appreciate some help.

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

The error message says, "Oops, try again. by_three(1) returned 1 instead of False"


Replace this line with your code.


#2

a function ends the moment a return keyword is reached, in your case in the first line of you by_three function:

return n % 3

remove this line


#3

2 posts were split to a new topic: 6. practice makes perfect


#4

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