Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
217,519 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.