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 trialDevin Hight
3,141 PointsWhat exactly is happening in the get_row = self.create_row(row) part of the create_grid method?
The logic of what exactly is happening is quite confusing in both create_row and the create_grid methods. Can someone explain it a little more simply? Thank you
1 Answer
Megan Amendola
Treehouse TeacherHi!
get_row = self.create_row(row)
is creating each row in the grid. get_row
is a variable that is holding the result of calling the create_row()
method and passing in a certain row number. This is then placed inside of a loop so you can get each row in the grid, because each time the loop runs, row
is a new number being passed into the create_row()
method.
create_grid()
is creating the structure of the grid, including the header, spaces, and pipes |
. It uses the create_row()
method to get each row and then organizes it using the spaces and pipes for printing to the console so the grid looks nice and neat.
Let me know if this helps or if you have any more questions :)
Devin Hight
3,141 PointsDevin Hight
3,141 PointsThanks a ton! For some reason I was having a hard time wrapping my head around that one.
Megan Amendola
Treehouse TeacherMegan Amendola
Treehouse TeacherAnytime! I'm glad I was able to help!
Timothy Mattingly
15,972 PointsTimothy Mattingly
15,972 PointsI think it's a bit confusing because you have two variables named row. One that holds the number in the range function and another that holds the list called row referenced in the
create_row
method That got me as well at first.