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 trialHarry Heathcock
8,407 PointsNeed help on the Line endings code challenge of Python collections.
Here is my current code:
for tile in TILES: output = tile line_end = "" if tile == "||": output = "" line_end = "\n" print(output, end = line_end)
TILES = ('-', ' ', '-', ' ', '-', '||',
'_', '|', '_', '|', '_', '|', '||',
'&', ' ', '_', ' ', '||',
' ', ' ', ' ', '^', ' ', '||'
)
for tile in TILES:
output = tile
line_end = ""
if tile == "||":
output = ""
line_end = "\n"
print(output, end = line_end)
2 Answers
Jason Anello
Courses Plus Student 94,610 PointsHi Harry,
As a hint, there needs to be a blank line between each line of output.
So when you encounter the double pipes, think about what you'd have to print to get a blank line.
Sean Rinn
2,134 PointsThe wording in this challenge needs some work. It implies the focus is on the 'end' parameter of the print function, which is what Harry's code solves.
I was stuck on this for a while due to the same interpretation.
Jason's hint is what it took to solve the problem.