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

Python Python Basics (2015) Number Game App Even or Odd

Even Odd Function

Can anyone please tell me why this code does not work?

Thanks!

even.py
def even_odd(number):
    number = int(input("Enter a number and we will tell you if it is even or false"))
    if number % 2 == 0:
        return True
    else:
        return False
Phillip Kerman
Phillip Kerman
Courses Plus Student 285 Points

As I understand the challenge, you need only write a function that accepts the number parameter. So, this part is not necessary:

number = int(input("Enter a number and we will tell you if it is even or false"))

(Plus, it is immediately overwriting whatever parameter is received for "number"

HTH

Hey Phillip, thanks.

Please try mentioning this as answer (rather than as comment) so that your answer could be accepted as best answer and the question can be closed.

Also, it helps the people trying to help on community portal as figuring out questions that have not been answered yet becomes easier.

Thanks once again for your help.