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 trialTed Polito
267 PointsCan figure out the spacing?
I am working on creating a space between my name and subject variables. I am having trouble figuring out where that space should be added to get the desired effect.
name = "Ted"
print(name)
subject = "Treehouse loves"
print(name + subject )
2 Answers
Jaxon Gonzales
3,562 PointsHi, Ted!
First, I would think about how you want these strings to join together:
#"Treehouse loves Ted"
Then think about what it would currently print out as:
#"Treehouse lovesTed"
Then figure out where the missing space is:
#"Treehouse loves[HERE]Ted"
And add it to the first string that is going to print:
subject = "Treehouse loves[]" #<== Add a space where the [] are
Hope this helps! -Jaxon
sepehr akbarzadeh
Python Web Development Techdegree Student 1,762 PointsYou need to give a space, when you want to print your variables. if you put a white space like bottom, you would get sure about a true white space when you want to take a input from user.
name = "Ted"
print(name)
subject = "Treehouse loves"
print(name + ' ' + subject )
Jaxon Gonzales
3,562 PointsJaxon Gonzales
3,562 PointsI'm so sorry. I just realized your question was about concatenation. Please do not pay attention to my answer as it does not have to do with string concatenation.