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.

Pankaj Gupta
3,469 Pointsboards.py
Now make all Board instances iterable so we can loop through their cells attribute. If you need help, refer back to the Emulating Builtins video.
class Board:
def __init__(self, width, height):
self.width = width
self.height = height
self.cells = []
for y in range(self.height):
for x in range(self.width):
self.cells.append((x, y))
class TicTacToe(Board):
def __init__(self):
super().__init__(3, 3)
4 Answers

Chris Christensen
9,281 PointsThe challenge says to review "Emulating Builtins" but it is simply underlined and not linked. The actual link is https://teamtreehouse.com/library/emulating-builtins and @kennethlove explains it at the 5:05 mark in the video.
Since this challenge is a bit separated from the "Emulating Builtins" video, it was good to go back and watch the video to understand how this challenge is solved.
Moderator Edit: Best Answer selected for this post

Rohit Gopalan
81,945 PointsUse yield from self.cells when you override the iter method.

Han Xiao
10,386 Pointsjust loop through, below works for me def iter(self): for item in self.cells: yield item

Tapiwanashe Taurayi
15,889 Pointscode
class Board: def init(self, width, height): self.width = width self.height = height self.cells = [] for y in range(self.height): for x in range(self.width): self.cells.append((x, y))
# Here is the code added
def __iter__(self):
for cell in self.cells:
yield cell
class TicTacToe(Board): def init(self): super().init(width = 3,height = 3)