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 trialivvffpqske
1,051 PointsIns and Outs Challenge question
In task 3 of 3 of this challenge I'm trying to understand why there needs to be a space between the quotation marks and love. Here's the entire code that works below:
name = "David"
treehouse = "Tree" + "house"
email_greeting = treehouse + " loves " + name
When I tried it without the spaces the code failed to pass. When adding the spaces it passed. Thoughts?
3 Answers
Dave McFarland
Treehouse TeacherWithout the spaces in the string " loves "
you'll end up with "TreehouselovesDavid"
in the email_greeting
variable. When combining string values you often need to add spaces just to make sentences that are readable such as "Treehouse loves David"
James Gill
Courses Plus Student 34,936 PointsDavid,
Unless Treehouse has some specific rule requiring spaces, this should pass (with or without spaces in the quoted string). Spaces look better, but they're not a Python requirement.
Roberto Garcia
Full Stack JavaScript Techdegree Student 24,603 Pointsname = "Roberto" treehouse = "Tree" + "house" email_greeting = "{} loves {}".format(treehouse, name)
This worked for me, try think as of replacing the curly braces with the variables you put in the format :) Good luck!
ivvffpqske
1,051 Pointsivvffpqske
1,051 PointsThanks Dave for helping me understand!