5/13 custom print try another way but fail. want to know why


#1


https://www.codecademy.com/courses/python-beginner-en-4XuFm/0/5?curriculum_id=4f89dab3d788890003000096#

Traceback (most recent call last):
File "python", line 12, in
File "python", line 9, in print_board
TypeError: 'int' object is not iterable

I just want to try using the "for a in len(x), print board[a]" as following, printing the index of the list, instead of using just print the item. But, as you see, I fail.

I just wander why. What is the problem with my code?

Thank you!


board = []

for i in range(5):
    board.append(["O"] * 5)

def print_board (x):
    for a in len(x):
        print board[a]

print_board(board)


#2

To make a an integer, work with a range()...

    for a in range(len(x)):