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) Logic in Python Conditional Value

I think this is bugged

if age >= 13: admitted = True this is my code for the challenge https://teamtreehouse.com/library/python-basics/logic-in-python/conditional-value. It keeps telling me that it does not see and if in my code and won't let me pass.

conditions.py
admitted = None

2 Answers

Gianpaul Rachiele
Gianpaul Rachiele
4,844 Points

I don't think it's a bug. You just need to pay attention to your spacing. Whitespace is important in python. So you need to make sure you have equal amounts of whitespace to signify a code block within a condition instead of:

admitted = None

if age >= 13: admitted =True

It should look like this:

admitted = None

if age >= 13:
   admitted = True
Name:GoogleSearch orJonathan Sum
Name:GoogleSearch orJonathan Sum
5,039 Points

Gianpaul Rachiele is right. I used to or still having this problem in these days with my uncarefully.

Charles Van Way
Charles Van Way
5,814 Points

Truly, the question/answer system may be bugged. The code works as written in my hands. But Gianpaul is correct about the proper form:

However, the question/answer system is extremely fussy. For example, I've had code fragments that work fine in my own interpreter or workspace that were rejected by the system. But in this case,the fragment is incomplete, and depends upon the system creating the "age" variable. You might want to add "age = 13" on a new line after "admitted = None" , and see if that will make the system happy. Failing that, it may be sufficient simply to reset the system. Exit the system, log back in, re-enter the answer, and see if that works. I've found that doing the examples in my own interpreter or in Workspace allows me to play around, and then copy and paste into the question/answer system.