Practice Makes Perfect


#1

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

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

 cube(3)
 by_three(3)

What's wrong with this code segment?


#2

In second function when a number is divisible by 3 then we have to return cube of that number but this code is returning the number itself.


#3

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