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

Hideki Matsuura
Hideki Matsuura
3,860 Points

What did I do wrong?

Not sure what I did wrong. I run it in work spaces and get the desired output.

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

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

1 Answer

By default the print function prints a newline. Passing in a newline will print the newline you specified and the newline the print function prints anyway.

Passing in no parameters to the print function (when you are trying to print the newline) should do the trick :smile:

print('\n')  # This prints TWO newlines. The challenge doesn't like this...

print()  # This prints ONE newline. The challenge seems to expect this in your code :)

I hope this helps. ~Alex

Thomas Helms
Thomas Helms
16,816 Points

... I was so rageface at this challenge...

This helps. Thanks Alex.