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

I don't get this this isn't working.

This looks correct to me or am I missing something?

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

for tile in TILES:

    if tile != "||":
        print(end="")
    else:
        print(end="\n")

1 Answer

Eric M
Eric M
11,545 Points

Hi Darrin,

You're very close and have the general idea, but as you suspected - yes, you are missing something.

This challenge asks you to loop through TILES and print the tile, or print a newline if the tile is ||.

Your code does not print any of the tiles. Your loop will print only blanks or newlines.

If you add tile as the first parameter in the print call in your if branch you'll get the desired behavior.

e.g.

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

Best of luck,

Eric