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

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!