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 trialBrian Foley
8,440 PointsMy code isn't working :(
Unfortunately I can't figure out why the program doesn't run when I preview the workspace. Here's what it looks like for me:
4 Answers
Jennifer Nordell
Treehouse TeacherHi there! You have an error on this line:
print( 'Nope, we don't have any ' + search + ', sorry');
Because you use an apostrophe inside the string, it believes that the apostrophe in "don't" is actually the end of the string. Try this instead:
print( "Nope, we don't have any " + search + ', sorry');
Hope this helps!
Jason Anello
Courses Plus Student 94,610 PointsHi Brian,
You have a problem with your quotes in this line
print( 'Nope, we don't have any ' + search + ', sorry');
You're enclosing the string in single quotes but you also have a literal single quote within your string.
You could either escape the single quote by putting a backslash in front of it
'Nope, we don\'t have any '
Or enclose the string in double quotes so that you don't have to escape single quotes within it.
"Nope, we don't have any "
Brian Foley
8,440 PointsThanks Jennifer. It was saved, I just hit the spacebar somewhere before taking the screengrab. Here's the snapshot: https://w.trhou.se/0g3maylssz
Brian Foley
8,440 PointsOh man I can't believe I didn't see that. Thanks so much!
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherHi there! This may sound silly, but make sure you've saved your file. In the picture provide here, the file isn't saved as denoted by the orange circle. If it's still not working, you might try including a snapshot to your workspace so we can look at the entire project.