Idk.Help please


#1



It's on Practice makes perfect.


Oops, try again. cube(2) returned 16 instead of 8. This is my main error message. Please help me fix it and explain what i did wrong if you could. Thanks


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


#2

** is an exponent operator, so according to your code:

cube(2) = 2 ** 2 ** 2 = 4 ** 2 = 16

It should be:

def cube(number):
    return number * number * number

or:

def cube(number):
    return number**3

#3

Thanks a lot. :slight_smile:


#4

You're very welcome! :slight_smile: