input: Write a python function to create a grid and simulate the Game of Life for a given number of iterations.
  assert len(createGrid(5, 5)) == 5
  assert len(createGrid(5, 5)[0]) == 5
  assert isinstance(initGrid(createGrid(5, 5)), list)
  assert isinstance(updateGrid(initGrid(createGrid(5, 5))), list)
output: import random
  
  def createGrid(rows, cols):
      return [[0 for _ in range(cols)] for _ in range(rows)]
  
  def initGrid(grid):
      return [[random.choice([0, 1]) for _ in range(len(grid[0]))] for _ in range(len(grid))]
  
  def updateGrid(grid):
      def countNeighbors(grid, x, y):
          neighbors = 0
          for i in range(-1, 2):
              for j in range(-1, 2):
                  if not (i == 0 and j == 0):
                      if 0 <= x + i < len(grid) and 0 <= y + j < len(grid[0]):
                          neighbors += grid[x + i][y + j]
          return neighbors
      
      new_grid = createGrid(len(grid), len(grid[0]))
      for i in range(len(grid)):
          for j in range(len(grid[0])):
              neighbors = countNeighbors(grid, i, j)
              if grid[i][j] == 1:
                  if neighbors < 2 or neighbors > 3:
                      new_grid[i][j] = 0
                  else:
                      new_grid[i][j] = 1
              else:
                  if neighbors == 3:
                      new_grid[i][j] = 1
      return new_grid
  
  def simulateGameOfLife(rows, cols, iterations):
      grid = initGrid(createGrid(rows, cols))
      for _ in range(iterations):
          grid = updateGrid(grid)
      return grid