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

Robert Zachara
Robert Zachara
1,304 Points

What am I doing wrong ?

I have problem with this task? Can anyone tell me what is wrong with my code and why?

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

1 Answer

andren
andren
28,558 Points

The code you have added is completely fine, the issue is the part you removed. You removed the 6th item from the TILES array (the last item on the first row). I assume you intended to copy it to paste it into your condition, but you ended up cutting it out instead.

Well regardless of how it happened, if you simply add it back in like this:

TILES = ('-', ' ', '-', ' ', '-', '||', # Added || back as the sixth item
         '_', '|', '_', '|', '_', '|', '||',
         '&', ' ', '_', ' ', '||',
         ' ', ' ', ' ', '^', ' ', '||'
)
for tile in TILES:
    if tile != "||":
        print(tile, end="")
    else:
        print("\n")

Then your code will pass.

Robert Zachara
Robert Zachara
1,304 Points

Yup. Thank you very much!