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

Why is it not working?

Please have a look at this challenge. Could you tell me what is wrong?

mapping.py
TILES = ('-', ' ', '-', ' ', '-', '||',
         '_', '|', '_', '|', '_', '|', '||',
         '&', ' ', '_', ' ', '||',
         ' ', ' ', ' ', '^', ' ', '||'
)
for item in TILES:
    if item != '||':
        endline = ""
        print(item, end=endline)
    else:
        endline = "\n"
        print("\n", end=endline)

Hi Brendan,

I was just looking into the answer, and still cannot get it. I tried to put two blank lines instead - does not work. Please advise.

Maiia

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,441 Points

There is some ambiguity in the challenge wording. A fully blank line is expected between printed characters. The short fix is to replace the else block with a simple

    else:
        print('\n')

Thanks a lot Chris!

Hi Maiia,

Your original code should have worked and it passes for me when I try it.

Chris' answer would be the more straightforward approach though.