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

Python Python Basics (2015) Logic in Python Loop

I 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
Steven Parker
229,644 Points

:point_right: Concatenation ("string pasting") is done with the plus-sign (+) operator.

For example, if   mystring = "Hello"   then   mystring + ", World!"   is the same thing as   "Hello, World!".

I guess I didn't word this right, but the error it's giving me is that I cannot concatenate lists and strings.

Ah! Figured it out. Thanks, Google. The answer was: print(greeting, "World")

Dios mio.