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 trial
Ana Paula Daros
8,436 PointsString Concatenation - lumberjack.py
Hello,
I'm having problems with lumberjack.py (https://teamtreehouse.com/library/python-basics/ins-outs/string-concatenation)
The console says there are syntax errors
Here's my code:
name = input("What's your name? ")
if name == "Kenneth":
print(name + " is a lumberjack and he's OK")
else:
print(name + " sleeps all night and " name + "sleeps all day")
4 Answers
Kenneth Love
Treehouse Guest TeacherAh. You're still in the Python shell. You need to exit() out of there before you run your script with python.
Fiction Project
605 PointsYou need to concatenate the end of " sleeps all night and " and name.
name + " sleeps all night and " + name + "sleeps all day"
Ana Paula Daros
8,436 PointsStill not working :(
name = input("What's your name? ")
if name == "Kenneth":
print(name + "is a lumberjack and he's OK")
else:
print(name + "sleeps all night and " + name + "sleeps all day")
Kenneth Love
Treehouse Guest TeacherCan you tell me more about how it's not working? You're using the Workspaces console and not your local machine, yes?
Ana Paula Daros
8,436 PointsYes, Kenneth. Here is a print: http://imgur.com/dXhTKil
Ana Paula Daros
8,436 PointsThe same happens when I use .format() http://imgur.com/EBGzwx9
Ricky Catron
13,023 PointsI think you need to add spaces before "is" and both "sleeps"