Here's my code for fuction 6


#1


<In what way does your code behave incorrectly? Include ALL error message


Replace this line with your code.


#2

On line 3 you have (number, cubed). Line 4 is also returning cubed. looking at your code I would venture to guess those should both be cube.


#3

You might have overcomplicated all of that, I printed this and ended up getting the right answer:

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


#4

You do more than they ask you for, your code can be as simple as this:

def distance_from_zero(loser):
    if type(loser) == int or type(loser) == float:
        return abs(loser)
    else:
        return "Nope"

As for the problem in your code, the error message is pretty self-explanatory. You have written "cube" as your variable, but use "cubed" in lines 3 and 4, which isn't defined in the function. Fix that and you should be good.

Hope that helps! :slight_smile:

-- @chipjumper36731


#5

okay i will try thank you


#6


#7

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