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 trialThomas Kjørlaug
1,054 PointsNeed help with Even or Odd objective
I've been away for a few weeks, and given that this is my first language and I've only spent one week getting to this point in the python tutorial, I'm a bit rusty.
Well, to be honest I have no idea how to complete this objective...
Here's my code. Feel free to laugh :P
def even_odd(5):
if 5 == % 2:
return True
else:
return False
even_odd()
3 Answers
Stuart McIntosh
Python Web Development Techdegree Graduate 22,874 PointsSo close...
The function takes one argument a number. Also the % operator will equate to '0' if an even number
def even_odd(num):
if num % 2 == 0:
# complete the the return
Hope that helps
Alex Life
16,114 PointsI’ll try since no one else has.. In def even_add(5) you need a variable name not an int., so that also changes your if statement Then at the bottom where you call it is where you give it a number.
Thomas Kjørlaug
1,054 PointsThank you guys! :D