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
Antonio Velardo
Courses Plus Student 111 Pointsa question on string combination
Now, create a variable named treehouse by combining two strings, "Tree" and "house".
i need to combine the two string , so i am assigning a variable and then putting the string and then again put the . format where is my mistake? Oops! It looks like Task 1 is no longer passing. Get Help Recheck work Go to task One name.py
name = "antonio"
x = "tree"
y = ( "{} house . format (name))
name = "antonio"
x = "tree"
y = ( "{} house . format (name))
2 Answers
Jacob Mishkin
23,118 PointsAntonio, your very close, but you just need to follow the instructions of the challenge. lets break doe the three questions and go from there:
question 1:
create a var and put your name as a string:
name = "Antonio"
question 2: It's asking you to just create two strings and concatenate them inside the var Treehouse, that's it. No need for anything else. It never asks you to create an x or y var, it asks you to create the var Treehouse.
Treehouse = "tree" + "house"
question 3: here all you need to do is further use concatenation in the var like so:
email_greeting = Treehouse + " loves " + name
and that's it. Just remember to follow the instructions, and you should be good to go. Also when using the format object, you need to close the string before applying the object to the string.
Sage Elliott
30,003 PointsHey! Well it looks like you're missing a double quote before your .format. This code would produce the string antonio house. If you want to put the word tree in swap out the (name) with (x)
name = "antonio"
x = "tree"
y = ( "{} house".format (name))
Antonio Velardo
Courses Plus Student 111 PointsAntonio Velardo
Courses Plus Student 111 PointsThanks it's clear now i hope