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

Dan Watson
Dan Watson
640 Points

Why does the error state Task 1 is no longer functioning? Task 1 was to import the random library, and it is still is.

I'm getting an error message stating that task 1, which was simply to import the random library is no longer functioning. I have 'import random' still in my code, so I do not know why this error message would occur . . .

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 start = True:
    temp = random.randint(1, 99)
    if even_odd(temp) = 0
        print("{} is even".format(temp))
    else
        print("{} is odd".format(temp))
    start = start - 1

1 Answer

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

Every time the code challenge is graded, it runs all of the steps with the current code. So if your code in step three introduces an error that the code challenge grader can't handle (like a syntax error that causes Python to completely stop), it'll report step one as being broken.

For your case, looks like it's because you used While and not while. Also, you need ==, not = because you don't do assignment in a while loop's condition. Check your ifs, too.