Hi I'm not sure I totally understand the challenge. for setting a variable to true or false using boolean logic.
If admitted has been assigned to false (i.e. none), How do I reassign it to become true. I had attempted to reassign to age which worked but when I wanted to include the else statement, the first code became invalid. Would appreciate any insight on this.
admitted = None if age>=13: admitted =bool(1) else admitted = bool(0)
Alex KoumparosPython Web Development Treehouse Moderator 30,355 Points
While it is true that bool(1) evaluates to
True. It's better practice to just assign True directly:
admitted = True
As for your invalid code, this is because your
else statement is at the wrong indentation level.
else should always be indented at the same level as its corresponding