Cube(1) returned 27 instead of 1


I couldn't find anyone else that has the same problem as I did. I've tried using other examples on this forum and everyone else's code looks exactly like mine so I'm not sure what is causing the issue. I appreciate the help!

I'm receiving the following error:
cube(1) returned 27 instead of 1

The coding appears to be correct and should give me a pass but it's not.

def cube(number):
   return 3 ** 3

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


your cube function:

def cube(number):
   return 3 ** 3

why 3 ** 3? if we call the function:

def cube(number):
   return 3 ** 3

print cube(5)

the number 5 we pass as argument doesn't matter, it only calculates cube of 3. Why is that?


2.) Make that function return the cube of that number (i.e. that number multiplied by itself and multiplied by itself once again).

And if you need another hint read your step 2 instructions carefully its tricky but with Stetim's example you should be able to correct yourself! :thumbsup:


Thank you guys! I see what the error is. Even though I was returning, I wasn't defining.


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