Functions Practice makes perfect


#1



Practice Makes Perfect


This gets outputted when I run the code:
Oops, try again. by_three(3) returned False instead of 27


def cube(number):
    #returns the cube of that number
    return number * number * number
def by_three(number):
    if number % 3 == 0:
        return False
    else:
        return number % 3 == 0


#2

if the number is divisible by 3 return cube() of number, else you should return False


#4

3 posts were split to a new topic: Practice makes perfect


#5
  1. Practice makes perfect
    It need to be like that.

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


#8

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