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 trialZhuo Zhang
1,368 PointsNot sure what's wrong with my codes.
I was told that "Did not get the correct result!". Yet, while I tested in Workspace, the result looks fine.
TILES = ('-', ' ', '-', ' ', '-', '||',
'_', '|', '_', '|', '_', '|', '||',
'&', ' ', '_', ' ', '||',
' ', ' ', ' ', '^', ' ', '||'
)
for s in TILES:
if s == "||":
line_end = "\n"
print(s, end = line_end)
else:
line_end = ""
print(s, end= line_end)
2 Answers
Mike Brooks
3,389 PointsYou are printing variable s when adding the new line. Instructions say to print "\n" INSTEAD OF "||" . You could try changing your first print statement to: print('', end = line_end). Notice double single quotes instead of s
Zhuo Zhang
1,368 PointsThank you both! I did not read the requirements carefully enough.
Zach Anderson
3,691 PointsZach Anderson
3,691 PointsYou code will run and print things out but the instructions say:
You're adding a newline at the double pipes || which is correct, but you're also printing them print(s, end = line_end)
If that helped mark this as an answer. If not just reply back and I can help you out!
Cheers, -Zach