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!
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
Robert Femi689 Points
This one should be short and sweet. Challenge Task 1 of 1
Why isn't the code accepted if I put ("True") and ("False") but it's accepted if remove brackets and quotation marks? Spent a LONG time figuring that out and would like to learn why so at least it won't be a complete waste of time. Would appreciate if someone can explain that to me. Many thanks.
def even_odd(number): if number % 2 == 0: return ("True") else: return ("False")
Alex KoumparosPython Development Techdegree Student 36,886 Points
Strictly, the problem is just with the quotation marks, not with the parens.
will pass but
This is because
"True" are completely different data types.
True is a boolean (a data type that can only ever be
False, and Python can understand semantically what true and false mean) and
"True" is a string (and Python doesn't generally have any way to understand what is semantically in a string, just that it is a sequence of characters).
As for the parentheses, they are completely redundant and should be removed.