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 trialTerry Joseph
Courses Plus Student 413 PointsI am really having trouble with this one?
Trying to use .format please help!
name = ("Terry")
subject = (.format("Treehouse loves ") + name
2 Answers
Evan Demaris
64,262 PointsHi Terry,
The dot operator, or period, is used to indicate a method available to an object, and is appended to the object and followed by the method name and arguments. In this case, the format() method is available to String objects, so would be appended to the string being formatted. Further information on this can be found in the Python documentation, but I've included an example below.
preterite = "memed"
"I accidentally {} the whole thing.".format(preterite)
Wilton cruz-ramirez
10,159 PointsI was doing it Just about the same but I saw a guy named chis code and this is what it's look like. Look the code and try to Understand it.
subject="treehouse loves {}".format(name)