Please i am stuck here can i please get the correct code


#1




they keep telling me : Oops, try again.
cube(1) returned None, did you remember to return the result?


def cube(number):
    if cube == (number ** 3):
        return cube
        
  
def by_three(number):
    
    if number / by_three == 0:
        return "cube(number)"
    else:
        return False
cube(1)


#2

For your first function, I am slightly confused why you put an if. You are not checking if cube is equal to number ** 3. I think you are just setting cube to equal number cubed and returning the result.

Solution: Remove if and replace with the word return

For your second function, I am really not understanding what you are trying to do. For example, you check if number divided by "by_three" is equal to zero. by_three is just the name of your function, so that doesn't do anything. It should be: if number % 3 == 0. The % sign gives the remainder of dividing the first number by the second number.

Another quick note is you return "cube(number)" which will just return the actual words, cube(number). I think you are trying to return the act of calling your first function which means you should remove the quotes.


#3

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