6. 'Practice Makes Perfect'


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)
        return False

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

Replace this line with your code.


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


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


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