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 trialnicholas Christie
433 Pointsi swear this is it?
?
time = 15
store_open = None
store_hours = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18]
if time in store_hours:
print(True)
else:
print(False)
2 Answers
Jason Anders
Treehouse Moderator 145,860 PointsHi Nicholas,
You're close and on the right track, but there are just a couple of things.
The major one is a syntax error. Your else
statement should not be indented. It needs to be the same level as the if
statement.
Second, the instructions do not ask you to print anything (And you can't print a Boolean). The instructions say to change the value of the variable based on the condition.
The store_open
variable is declared and assigned an initial value outside of the if/else
block, so it is available globally and just needs to changed inside the block. So, you'll need to reassign the value and not use print()
.
Give it another go with this in mind. I'm sure you can get it! :)
Keep Coding!
nicholas Christie
433 Pointsit was indentation error on line 11 and only had 9 lines. I was kind of confused but starting to see why its important to pay attention to indentation thanks i got it.
nicholas Christie
433 Pointsnicholas Christie
433 Pointschanged values still not working
Jason Anders
Treehouse Moderator 145,860 PointsJason Anders
Treehouse Moderator 145,860 PointsI had to add markdown to your comment so the code can be read. When posting code, you need to use Markdown, or the code snippet is not readable in the Community. There is a Markdown Cheatsheet above the "Post" button for your reference.
Now, your code. The assignments are correct, but now the indentation is backwards. The assignments need to be inside the
if / else
statements. You had the indentation correct in your original post, except for theelse
that should not have been indented.