title: Generating random X,Y coordinates in a grid
body: <p>I'm fairly new to Python and this site. I'm hoping someone can help me with this and clarify a few things. I'm stuck at this part in my battleship program. I have a 10x10 grid and I want to randomize the locations for each of the 3 ships within my grid . I also want to display the location when I want them revealed. I've been trying to imitate this using other methods but to no avail.</p>
  
  <p>My current grid looks like this:</p>
  
  <pre><code>print(" 0 ","1 ","2 ","3 ","4 ","5 ","6 ","7 ","8 ","9","10")
  
  symbol = " O "
  row = 0
  
  for i in range(0,11):
      print(symbol*11 + " " + str(row))
      row += 1
  </code></pre>
  
  <p>For example, I want the grid to look like this when I choose to reveal the location of ships 1, 2 and 3:</p>
  
  <pre><code>O O O X O O O O O O
  O O O X O O O O X O
  O O O X O O O O X O
  O O O X O O O O X O
  O O O O O O O O X O
  O O O O O O O O O O
  O O X X X X O O O O
  O O O O O O O O O O
  O O O O O O O O O O
  O O O O O O O O O O
  </code></pre>