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 (2016, retired 2019) Dungeon Game Line endings

Harry Heathcock
Harry Heathcock
8,407 Points

Need help on the Line endings code challenge of Python collections.

Here is my current code:

for tile in TILES: output = tile line_end = "" if tile == "||": output = "" line_end = "\n" print(output, end = line_end)

mapping.py
TILES = ('-', ' ', '-', ' ', '-', '||',
         '_', '|', '_', '|', '_', '|', '||',
         '&', ' ', '_', ' ', '||',
         ' ', ' ', ' ', '^', ' ', '||'
)

for tile in TILES:
    output = tile
    line_end = ""
    if tile == "||":
        output = ""
        line_end = "\n"
    print(output, end = line_end)

2 Answers

Hi Harry,

As a hint, there needs to be a blank line between each line of output.

So when you encounter the double pipes, think about what you'd have to print to get a blank line.

The wording in this challenge needs some work. It implies the focus is on the 'end' parameter of the print function, which is what Harry's code solves.

I was stuck on this for a while due to the same interpretation.

Jason's hint is what it took to solve the problem.