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

Alexander Besse
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Besse
Full Stack JavaScript Techdegree Graduate 35,115 Points

Python Collections - Tile Work

Seems like an easy enough problem, especially because we did something like this in the last video - getting "Bummer: Didn't get right output." Any suggestions? Thank you!

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

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

1 Answer

If tile is || you should only print a new line not the item. Also if you define a function you need to call it.

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

tile_magic()