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 trialEddy Avila
846 PointsI can't remember how to add a string when printing a variable.
Like a bum I failed to to take notes, and now I can't remember how to print the variable list with "World" added to to each list entry.
1 Answer
Steven Parker
231,236 PointsConcatenation ("string pasting") is done with the plus-sign (+) operator.
For example, if mystring = "Hello"
then mystring + ", World!"
is the same thing as "Hello, World!"
.
Eddy Avila
846 PointsEddy Avila
846 PointsI guess I didn't word this right, but the error it's giving me is that I cannot concatenate lists and strings.
Eddy Avila
846 PointsEddy Avila
846 PointsAh! Figured it out. Thanks, Google. The answer was: print(greeting, "World")
Dios mio.