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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![victor E](https://uploads.teamtreehouse.com/production/profile-photos/7658112/micro_just_I.jpg)
victor E
19,145 Pointsclose but not quite
my else statement is wrong but im drawing a blank here
TILES = ('-', ' ', '-', ' ', '-', '||',
'_', '|', '_', '|', '_', '|', '||',
'&', ' ', '_', ' ', '||',
' ', ' ', ' ', '^', ' ', '||'
)
for item in TILES:
if item != '||':
print (item)
else:
TILES= '\n'.join(TILES)
2 Answers
![Chris Freeman](https://uploads.teamtreehouse.com/production/profile-photos/1153532/micro_image.jpg)
Chris Freeman
Treehouse Moderator 68,425 PointsEvery print statement has an implied \n
appended. So the challenge is actually asking is to print any non-||
item without a \n
(this can be done with the end argument), and to print a new line if the item is ||
. For the second condition, both print()
and print('\n')
will work.
Post back if you have more questions. Good luck!!
![victor E](https://uploads.teamtreehouse.com/production/profile-photos/7658112/micro_just_I.jpg)
victor E
19,145 Pointsfor item in TILES:
if item != '||':
print (item, end = ' ')
else:
print(end = '\n')
this one works on my idle, what do you think? Chris Freeman
victor E
19,145 Pointsvictor E
19,145 PointsThis one works on my idle, but its not accepted for the challenge
victor E
19,145 Pointsvictor E
19,145 Pointsi had an extra space on my end statement. thats why it wasnt working but i got it figured out. Thank you!
Chris Freeman
Treehouse Moderator 68,425 PointsChris Freeman
Treehouse Moderator 68,425 PointsGood job figuring it out!