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

tiles

I'm not sure where i'm wrong here and also how to use the end argument

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

for x,y in items():
    if y in TILES.values():
        if y != ("||"):
            print (\n"")

1 Answer

Steven Tagawa
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Steven Tagawa
Python Development Techdegree Graduate 14,438 Points

Hi Mathew,

Can you explain a little more about precisely what you're trying to get your code to do? Right now TILES is one very large tuple with lots of elements, and you can't say TILES.values because .values only works with dictionaries. If you want TILES to be a list that you can loop through, you need to use brackets [] instead of parentheses. But you still won't be able to use .values with it.

Oh, and when you want to print a line break, \n is the actual string for it, so you need to print("\n")...

Yeah i see , i'm just trying to loop through the tuple first