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

Python Python Collections (Retired) Dungeon Game Building the Game: Part 2

Harish Vadlamani
Harish Vadlamani
1,724 Points

In the Dungeon game under 'Python Collections: Building the game part 2' you have used print(___, end=' ')

I couldn't completely comprehend the explanation for its usage. Could you expand on it a little more?

1 Answer

Steven Parker
Steven Parker
230,995 Points

I could not find that exact statement in the video.

But in general, the first argument to print is what will be printed. In the video this seemed to be either a literal string enclosed in quotes, or a string variable with a .format method to fill in a placeholder in the string.

the end=' ' supplied as a second argument tells the print to not add anything at the end. Normally it would add a line-end sequence so the next print would go on a lower line. But by specifying the end to be blank, the contents of the next print will go on the same line as this one.