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 trialYessica Schoonen
1,553 PointsSyntaxError at Task 1
Pretty sure I forgot something here but don't know what....
def odd_even(5):
if number == False
return
odd_even()
2 Answers
Kurt L
22,856 PointsThe challenge is asking us to define a function that takes one parameter, a number (hint: integer is best). The function should then test the number that was passed in, and return True
if the number is even (that is, the remainder after dividing by 2 is 0), and to return False
otherwise. :)
Christian Rowden
2,278 PointsHello,
What this lesson is trying to teach you is %
For example, 10 % 2 == 0. This is because % will return the remainder of a division so 10 / 2 = 5.0
so 10 % 2 == 0
if you code an if statement like the following:
if arg % 2 == 0:
return True
else:
you'll be on the right track.
Cheers and happy coding.
Yessica Schoonen
1,553 PointsAhh I get it, I always end p being confused when the tasks come up. Thanks for helping out :)
Kurt L
22,856 PointsKurt L
22,856 PointsHint: the definition should start like this:
def odd_even(number):
Yessica Schoonen
1,553 PointsYessica Schoonen
1,553 PointsThanks for helping!!