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

unexpected string

what does unexpected string mean when its a variable

conditions.py
admitted = None
age = 15
    if age > 13: admitted = True 

2 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,423 Points

Sorry the feedback message isn't very clear. The issue is the indentation of the if command. It should start at the beginning of the line. Also,

  • the admitted assignment should be on a new line indented more than the if
  • the check should be if age is greater than or equal to 13, not just greater than 13
  • remove the age = 14 assignment. The challenge checker will set age to various values during testing. Setting the valued explicit interferes with the checker.

Post back if you need more help. Good luck!!

Chris Freeman is correct.

Your code should be like this:

admitted = None
age = 15
    if age > 13: 
        admitted = True