Need help please


#1


#2

same i need help is well guys


#3

The mistake is in your by_three() function when you check if by_three % 3 == 0.
by_three is the name of your function not the function parameter(that's number).

def my_function(number):
    if number > 5: #here I check if the parameter is bigger than 5
        return "Bigger than 5."
    else:
        return "Not bigger than 5."

#4

This is how i coded.
def cube(n):
return n*n*n
def by_three(n):
if n % 3 == 0:
return cube(n)
else:
return False
It worked.


#5

That worked! Thank you. I am only not understanding what a 'def' is. Is it similar to the div function in HTML?


#6

The def statement tells python that you will define a function. Once you definded a function you can use it elsewhere in your code.

#here I define a new function called my_function()
#it will not be executed unless the function is called elsewhere in the code
def my _function():
    print("Hello")

#here I call the new function, that's only possible after I definded it
my_function()
#prints "Hello"

#7

Thank you for the clarification! Much appreciated!