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 trialPetko Draganov
Courses Plus Student 2,005 Pointsjust didnt get the right results here....
i know, that, im close to true, but all try all variants and didnt passed. In console running perfect. :( ?
TILES = ('-', ' ', '-', ' ', '-', '||',
'_', '|', '_', '|', '_', '|', '||',
'&', ' ', '_', ' ', '||',
' ', ' ', ' ', '^', ' ', '||'
)
for i in TILES:
print(i, end=" ")
if i == '||':
print(end="\n")
2 Answers
Erika Suzuki
20,299 PointsHi,
You're almost there.
You are printing ||
on each loop too because you're printing it first and then checking for it.
Correct answer would be:
TILES = ('-', ' ', '-', ' ', '-', '||',
'_', '|', '_', '|', '_', '|', '||',
'&', ' ', '_', ' ', '||',
' ', ' ', ' ', '^', ' ', '||'
)
for i in TILES:
if i == '||':
print()
else:
print(i, end='')
Notice the end=''
, it is to prevent print()
function from using the default line-break.
Petko Draganov
Courses Plus Student 2,005 PointsThanks a lot, man :)
Every time I miss something ...