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 trialDan Anchia
660 Pointsout put of print
#when i do the following
>>> print('hello ... )'+'he')
#i got this... without the ' ...'
hello ... )he
# but when i do
>>> 'tree' + 'house'
# i get the text in a ' ...' ??
'treehouse'
[MOD: added ```python formatting -cf]
3 Answers
Chris Freeman
Treehouse Moderator 68,441 PointsYou have to mind where the quotes are. In your first print you have the two strings:
print('hello ... )'+'he')
# has two the strings
"hello ... )" and "he"
The output is the concatenation of these two.
Were you expecting something different?
Matt Nickele
468 Pointsso when you add text in the console it will have '..' however if you for example make the variable tree = "tree" + "House" and then print(tree) this should print with out ''. for the first question what you should type is print('hello' + 'he' ) all in the same parentheses.
Dan Anchia
660 PointsI just was wondering why... I'm sorry. I din't notice that one was using print and the other was just adding two strings together.
'tree'+'house' 'treehouse' print('tree'+'house') treehouse
Thank you for your help.
Matt Nickele
468 PointsHey Dan,
happy to help, good luck with your future coding!!
Chris Freeman
Treehouse Moderator 68,441 PointsChris Freeman
Treehouse Moderator 68,441 PointsEdit I think the formatting on your original post was misleading. The interactive python shell has two prompts.
>>> is the standard prompt.
...
is the continuation prompt that appears if the previous code is an incomplete statement. Sometime a missing closing quote or paren will cause the continuation prompt.