Custom print


maybe i missed this in an earlier exercise but why do i need to use Y to get the right response. I notice that throughout the lessons Ive been reqired to use y and i and X but i dont fully understand what is the meaning of using those specific letters

board = []
for item in range(5):
    board.append(["O"] * 5)
def print_board(board):
    for y in board:
        print y



you don't? you can use every word/letter you like:

def print_board(board):
    for row in board:
        print row

look at the loop:

for row in board:

row is the iterator, your define it in the loop, and in sequence it will hold each item of the list

because you define the define the iterator in the loop, you can call it anything you like


I see thank you i had item before and it was not giving me the needed results and changed to y as i has used y in prior lessons and it worked , which is why i was so confused


item should also have worked as iterator, must have been something else (a mistake is easily made in coding), but if you now understand it, you should be good to move on :slight_smile:


yeah i think i may have misspelled it . Thank you for you help