title: Accidentally changed a list to generator
body: <p>I am writing a Battleship game and I"m facing a few problems. I already wrote some lines of code enough to create a 10x10 map, random the location of a ship and give the player 10 turns to guess. Now I am trying to put numbers 1-10 in the top row and in the first column to make the map more clear.
  Unfortunately it looks that after adding the numbers I changed my list to something different:</p>
  
  <pre><code>from random import randint
  
  board = []
  
  board.append((str(n) for n in(range(0, 11))))
  liczba_kolumn = 10
  
  for x in range(9):
      board.append([str(x + 1)] +["O"] * liczba_kolumn)
  
  board.append(["10O"] + ["O"] * (liczba_kolumn - 1))
  
  def print_board(board):
      for row in board:
          print(" ".join(row))
  
  print ("Let's play Battleship!")
  print_board(board)
  
  def random_row(board):
      return randint(1, len(board))
  
  def random_col(board):
      return randint(1, len(board[0]))
  
  ship_row = random_row(board)
  ship_col = random_col(board) `
  for turn in range(10):
  
      print ("Turn " + str(liczba_prob)) 
      guess_row = input("Guess Row:") 
      guess_col = input("Guess Col:")
      liczba_prob = liczba_prob - 1
      if guess_row == "" or guess_col == "":
          print ("guess the location")
      else:
  
          guess_row = int(guess_row) - 1
          guess_col = int(guess_col) - 1
          if guess_row == ship_row and guess_col == ship_col:
              print ("Congratulations! You sunk my battleship!")
              break
          else:
              if (guess_row &lt; 0 or guess_row &gt; 9) or (guess_col &lt; 0 or             guess_col &gt; 9):
                  print ("Wrong localisation")
              elif(board[guess_row][guess_col] == "X"):
                  print ("You already guessed that one.")
  </code></pre>
  
  <p>First bug was </p>
  
  <pre><code>return randint(1, len(board[0]))
  TypeError: object of type 'generator' has no len()
  </code></pre>
  
  <p>I changed both random_functions from len() ones to just "11". But the next bug is </p>
  
  <pre><code>elif(board[guess_row][guess_col] == "X"):
  TypeError: 'generator' object is not subscriptable.
  </code></pre>
  
  <p>My question is - in which moment did I change my board[] list to 'generator' and how do I turn it back into a list?</p>
  
  <p>EDIT:</p>
  
  <p>Thank you for your answers, they helped me a lot. Now I am trying to understand a different thing - why does the code</p>
  
  <pre><code>board = []
  board.append(["10O"] + ["O"] * (10))
  print(" ".join(board))
  </code></pre>
  
  <p>returns a bug : sequence item 0: expected str instance, list found ?
  First and the next items are all in bracket. A code that looks pretty the same returns no bug:</p>
  
  <pre><code>board = []
  board.append(["10O"] + ["O"] * 10)
  def print_board(board):
      for row in board:
          print(" ".join(row))
  print_board(board)
  </code></pre>