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 trialLisa Ess
7,193 PointsWhen I try to use the "if not age" statement, I keep getting syntax errors. Halp?
I have tried to reproduce this just like the video and just get errors over and over again, pointing to the "if" part of the statement. Confuzzled.
5 Answers
Sebastian Sõeruer
12,353 Points... print("You're old") <- you have 5 spaces in here, but it needs to be 4.
Omar Richardson
3,452 PointsHey Lisa,
There is an issue with the indentation of the print line. Should look like this
age = 34 * 365
if age > 10000:
print("You're old")
someguy1234
3,450 PointsKenneth didn't mention about the indentation for "if" and "else" but I found the solution anyway (feel like I grow, yay!). Thank you Omar Richardson. If should not have any indentation but the workspace in the quiz always give us an indentation automatically. That's why it has syntax error. Thank you!
Cindy Lea
Courses Plus Student 6,497 PointsPlease link your code
Lisa Ess
7,193 PointsHrm. Okay. I was following the lesson and typed exactly what the lesson said.
>>> age = 34 * 365
>>> if age > 10000:
... print("You're old")
... if not age >20000:
File "<stdin>", line 3
if not age >20000:
^
SyntaxError: invalid syntax
Nitram Sinned
7,723 PointsIt looks like you're missing the elif (if I'm reading this right);
age = 34 * 365
if age > 10000: ... print("You're old") ... elif not age >20000: ... print("You're young") ... You're old