Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Collections (2016, retired 2019) Dungeon Game Line endings

Eduardo Diaz
Eduardo Diaz
Courses Plus Student 6,048 Points

couldnt evaluate your script

im a little confused as to wether should i separate the elements in the tuple wth spaces or not, and i dont undestand why cant it evaluate script?

TILES = ('-', ' ', '-', ' ', '-', '||',
         '_', '|', '_', '|', '_', '|', '||',
         '&', ' ', '_', ' ', '||',
         ' ', ' ', ' ', '^', ' ', '||'

for tile in TILES:
    if title is not '||':
        print(title, end=' ')

Hey Eduardo:

Make sure that you spell your iterable the same throughout. In the for loop, you spell it 'tile' and in your if condition and print function, you spell it 'title'.

Hope this helps.

Hey Eduardo!

In the for loop you call the items inside TILES "tile" while in the if statement you call it "title". You need to call it with the same name. And you don't need to put a space in the end variable (with end='' is enough).

1 Answer

Seems like your question is still not answered, as it pops up in list of unanswered questions.

Besides what is mentioned by Eddy Hood and Emmanuel Jiménez, you also need to understand the difference between 'is' and '=='. Or in this case, 'is not' and '!='.

Is checks if the both variable are pointing to same object whereas == checks the value.

So may be this is what you need.

for tile in TILES:
    if tile != '||':
        print(tile, end=' ')

If this is not your answer and you already got the answer, post it and accept is by upvoting.

Enjoy coding.