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

Shawndee Boyd
Shawndee Boyd
6,002 Points

I am at the 3rd code challenge question on Ins & Outs within Python Basics and I am completely stumped. Please help!

I have passed the first 2 questions

2 Answers

Stone Preston
Stone Preston
42,016 Points

its the same concept as task 2 (you just are concatenating variables this time as well in addition to string literals). use the + operator to concatenate strings together. you need to concatenate the treehouse variable, the string " loves " and the name variable.

you need to use spaces before and after loves so the string comes out as "Treehouse loves stone" and not "Treehouselovesstone".

name = "stone"
treehouse = "Tree" + "house"
email_greeting = treehouse + " loves " + name

you could also use the format funtion of str to do this as well

name = "stone"
treehouse = "Tree" + "house"
email_greeting = "{} loves {}".format(treehouse, name)
Shawndee Boyd
Shawndee Boyd
6,002 Points

It worked. My problem was that I chose the first example you put up and I had parentheses around it. Thank you very much.