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 trialAf Mondal
2,437 PointsIf else condition is not working
In chaleenge part 2 if else condition is not working. They need first task have to pass in second one but they also need to execute the else block instead of first one. How it's even possible....
admitted = None
age = 16
if age >= 13:
admitted = True
else:
admitted = False
In first task they need to change the value of "admitted" variable to true and in second task they need to add else block and change the value of "admitted" variable to False. How?? Please Help...............
1 Answer
Seth Reece
32,867 PointsHi Af,
Don't declare a value for age. The challenge will pass in its own value for age. By setting it to 16, the code will never evaluate to false. e.g.
admitted = None
if age >= 13:
admitted = True
else:
admitted = False
Af Mondal
2,437 PointsAf Mondal
2,437 Pointsoooooooooofffff, Now I get it what I was doing wrong. Thanks a lot.