Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Practice Creating and Using Functions in Python Practice Functions That's Odd

Nataliya Fateeva
seal-mask
.a{fill-rule:evenodd;}techdegree
Nataliya Fateeva
Python Development Techdegree Student 4,673 Points

PyCharm interpreter returns correct value for 1 but Challenge test does not:/

When I run the is_odd(1) in PyCharm it returns True as it should but Challenge tests keep complaining that is_odd(1) returns False :/ What is happening? Why the discrepancy?

create_a_function.py
def is_odd(num):
    remainder = num % 2
    if remainder != 0:
        print('True')
    else:
        print('False')
    #elif num == 1: 
        #print('True')
    #else:
        #print('False')

1 Answer

Hi Nataliya

In the challenge you need to use return instead of print.

Edit: Don't forget to lose the parens and the single quotations marks.

Hope this helps!