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

Omid Ashtari
Omid Ashtari
4,813 Points

Line Endings - works in my console, but test won't pass :(

hi, need a little help, why won't this pass? - thx

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

for tile in TILES:
    if tile == "||":
        line_end = "\n"
        print("", end=line_end)
    else:
        line_end = ""
        print(tile, end=line_end)
Omid Ashtari
Omid Ashtari
4,813 Points

figured it out by looking at some other questions about this

hey Kenneth Love, it's not very clear that a full empty line needs to be printed every time a || appears, the way I read it, seems to suggest to just print the next set of items on a new line, without the separate extra line to divide items.

2 Answers

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

I've updated the code challenge so hopefully there'll be less confusion from now on. Thanks for bringing it up!

Steven Parker
Steven Parker
231,269 Points

Thanks, Kenneth, that makes the challenge solution much more intuitive.

Steven Parker
Steven Parker
231,269 Points

You might also want to submit your bug report to Support.

It may even get you a "special Exterminator badge".