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.

Python Python Basics (2015) Letter Game App Even or Odd Loop

Matte Matt
Matte Matt
2,354 Points

I have done everything right, but it tells me I have the wrong number of prints??

It says I have too many prints, but I have two and the question is ASKING FOR TWO!

What do I do?

even.py
import random
def even_odd(num):
    # If % 2 is 0, the number is even.
    # Since 0 is falsey, we have to invert it with not.
    return not num % 2
start = 5
while even_odd(start) == False:
    ranNum = random.randint(1,99)
    if even_odd(ranNum) == True:
        print("{} is even".format(ranNum))
    else:
        print("{} is odd".format(ranNum))
    start = start - 1

1 Answer

Hey Matte! Indeed you have not done everything right, if this was the case you would pass :P

It says I have too many prints, but I have two and the question is ASKING FOR TWO!

No? Where did you read this. It says to run the while loop until start is 0. That was the whole point of having the start variable. Fix that and youll pass, happy coding!