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.
Stefan Vaziri17,453 Points
I think I'm close but I'm not sure what's missing...
def even_odd(num): guess = int(input("Guess a number?")) if guess == (num%2 == 0): print("True") else: print("False")
Chris FreemanTreehouse Moderator 68,082 Points
The challenge asks
Write a function named even_odd that takes a single argument, a number. Return True if the number is even, or False if the number is odd.
You don't need to ask for input. The function argument is how the input is passed to the function.
The built in values
False should be returned instead of strings.
def even_odd(num): if num%2 == 0: print(True) else: print(False)
The if conditional can be used directly as the return value:
def even_odd(num): return num % 2 == 0
Magali Doucet2,330 Points
I dońt understand why the num divise by 2 should equal 0. Why dońt we just ask the function ; if you can split by 2 the number and it stay a float. Return true, else return false