What's Wrong with my function? can somebody help me?


I Have Problem with lesson python, in the Practice Makes Perfect in the function
there’s my code

def cube(number):
  n = number
  if n % 3 == 0:
    print "n divisible by 3"
  return number

def by_three(number):
  print "n is not"
  return number


And the error result is “cube(2) returned 2 instead of 8”


Oh Sorry it’s Done

def cube(number):
  return number**3

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


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