Please help with functions exercise six


#1



HELLO WORLD!!! I have a glitch in my program and I was wondering if anyone could help me out. Thanks in advance!

https://www.codecademy.com/en/courses/python-beginner-c7VZg/1/5?curriculum_id=4f89dab3d788890003000096 (section 7. functions, exercise six)

I expected it to cube the results, but each time I try to format differently it says it returns numbers that are not correct such as "two cubed did not result it eight".

Here is my code...

def cube(num):
return num ** 3

def by_three(num):
if num % 3 == 0:
print " your number is divisible by three"
return num
else:
print "your number is not divisible by three"
return False

and a photo...


#2

Figured out my problem! Here is the answer...

def cube(num):
return num ** 3

def by_three(num):
if num % 3 == 0:
print " your number is divisible by three"
return cube(num)
else:
print "your number is not divisible by three"
return False


#3

i need help on exersise 5 functions


#4

Well, can we see your code and error message?


#5

i figured it out i am on exersise 10 functions now:upside_down:


#6

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