I'm confused...can someone help me?


#1

https://www.codecademy.com/en/courses/python-beginner-c7VZg/1/5?curriculum_id=4f89dab3d788890003000096#

Oops, try again. by_three(3) returned instead of 27

Anyone know what I'm doing wrong with my code? :confused:

n = raw_input("Please enter a number")

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

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

#2

The return statement in that should be:

return cube(number)

#3

Ah, ok. It works now. Thanks!


#4

Wlecome! :slight_smile: Glad to help.


#5

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