Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Can someone please tell me what I am doing wrong. Thanks!

These are the instructions:

Let's create a function that determines if a specific value is odd. Let's name the function is_odd and have it declare a single parameter. It should return True if the value is not divisible by 2.


1 Answer

33,293 Points

You have some syntax errors.

the first one and the most noticeable one is on the first line of your code (the definition of the function) Your code:

def is_odd (number):

No spaces in between the name of the function and the parameters, like this:

def is_odd(number):

The other mistakes are indentation mistakes, it looks like you have indented with tab twice (thats 8 spaces, suposing you are using pythons indentation), you only need to indent the lines inside the function by four spaces (which makes a single python indentation) and if you have a statement inside the function then the statement content needs to be indented as well, and so on like this:

def is_odd(number):
    if number % 2 == 0:
        return False
        return True