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.

Young Gon Kwon
Courses Plus Student 1,426 PointsNeed support about "even_odd.py" : Wrong number of print
Hello, there~!
Keep showing that "Bummer! Wrong number of print". I can not find a clue why the message pups up. It was working at the workspaces.
Please let me know what is wrong with my code please~!
Thank you previously!
import random
start = 5
def even_odd(num):
global start
while start != False:
value = random.randint(1,99)
if value %2 != 0:
print("{} is odd".format(value))
else:
print("{} is even".format(value))
start = start - 1
#print(start)
return start
# If % 2 is 0, the number is even.
# Since 0 is falsey, we have to invert it with not.
return not num % 2
2 Answers

Brett McGregor
Courses Plus Student 1,903 PointsHi there, I'm a Python beginner but I will try to assist you.
You will need to create the while loop outside of the even_odd function (i.e the while loop is not defined within any function in this challenge). That way you will not face the problem of accessing the start variable.
Also, Kenneth mentions to use the even_odd function to do the check for you. So you will need to replace that part of your code within the while loop to use the even_odd function.
I have code that works which I could post here... but have a try yourself and see if you can get it. ;)
[MOD: changed comment to answer - srh]

Young Gon Kwon
Courses Plus Student 1,426 PointsThank you for your support~! It was very critical clue to solve the quiz!