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 trialA Chatterjee
1,701 Points[SOLVED] What am I doing wrong in my if else statement in Python?
The question asks to set a certain variable to True if a condition is met. Else set it to false. I am setting the variable to a value such that the condition for True is met. So obviously the Else statement fails and the variable is not set to False. But the automated code check doesn't pass my code.
Ken Alger
Treehouse TeacherEdited for [solved].
2 Answers
A Chatterjee
1,701 PointsI figured it out. I was creating the variable and adding a value to it, before the if/else statements, so only one condition was getting tested.
A Chatterjee
1,701 PointsThanks for offering to help!
Ken Alger
Treehouse TeacherKen Alger
Treehouse TeacherWelcome to Treehouse!
Can you post the code you are using? It might be a small syntax error.
Thanks,
Ken