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 trialigsm '
10,440 PointsDungeon PART 2. What does end = '' mean?
Hey! Please can someone explain once again what does end ='' mean and how can I write this print statement (print tile.format('X'), end='') in Python 2, as I do not use parentheses in print statements in Python 2 and if I do, it give out Syntax Error... Thanks
3 Answers
Kenneth Love
Treehouse Guest TeacherIn Python 2, you'd do it like:
print "something",
And it would continue to print on the same line because of that comma.
shezazr
8,275 Pointshe did explain it. if you dont say end="" then print statement by default adds a new line character to the end. but here you dont wnat that so you are telling python to not do that
Erion Vlada
13,496 PointsDo it how it is done in the video. Just import this (from __future__ import print_function
) at the top of your file. This will treat your prints as a python 3.x print.
ericb2
11,429 Pointsericb2
11,429 PointsIn the context of the drawing the game map, the two aren't quite the same. ending python2's print with comma adds a space
Examples: