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
johnpatrick2
3,647 PointsWhy does this script not work?
Why does this script not work?
def is_odd(number_input): test = number_input % 2 print (number_input) print(test) return test == 0
number_input = input("Enter a number: ")
3 Answers
Steven Parker
243,228 PointsYou didn't provide a link to the course page, but if I remember correctly the instructions only ask you to return the result. They don't ask you to "print" or "input" anything (and doing so will confuse the validator).
johnpatrick2
3,647 PointsI added the extras for my own learning experience. I would not include them in my submission. Why does the script I wrote not work? I don't see what is wrong with it.
johnpatrick2
3,647 PointsThanks for the help. What is best way to create the markdown? I tried the three back ticks as in the video but that did not work.
Steven Parker
243,228 PointsWere the 3 backticks on a line by themselves (or with only the language name following)?
That's important to make it work.
And if this resolves your issue, you can mark the question solved by choosing a "best answer".
Happy coding!
johnpatrick2
3,647 PointsAre you saying do not use Python? I think you are saying use ``` by themselves on first line and last line. Is that right? What is the best way to test this?
Steven Parker
243,228 PointsYou can use the language name for syntax coloring. So the first line can be ```python
An even better way to allow your issue to be precisely replicated is to make a snapshot of your workspace and post the link to it here.
Steven Parker
243,228 PointsSteven Parker
243,228 PointsFor just testing, this code defines but doesn't call the function. Did you intend to do something like this after the input?
print(is_odd(int(number_input))) # test the functionAlso, doing "
% 2" tests for even instead of odd. And there could be hidden formatting issues. When posting code to the forum, use Markdown formatting (as I did above) to preserve the appearance.