Creating a grid to the specified size using lists
Grid creation

You know about list-comprehensions, but you use a default value before filling your rows with zeroes. You could do it in one go:

grids = [[0 for _ in range(gridSize)] for _ in range(gridSize)]


which can be simplified to

grids = [[0] * gridSize for _ in range(gridSize)]


Grid printing

The for loop in Python is meant to be used to iterate directly over elements rather than indices:

for row in grids:
    print(row)


Function parameters

It is bad practice to rely on global to share data accros functions. You should define those function to accept parameters instead.

This let you also extract input handling from your grid creation function which is also better as let you have a single responsibility per function:

def ask_size():
    while True:
        try:
            grid_size = int(input("input grid length and width\n"))
            if grid_size &lt; 2:
                print ("invalid int")
            else:
                return grid_size
        except ValueError:
            print ("invalid input") 

def make_grid(size):
    return [[0] * size for _ in range(size)]

def print_grid(grid):
    for row in grid:
        print(row)


grids = make_grid(ask_size())
print_grid(grids)


Exception handling

Python have else clauses that are executed when the try part succeeded. The aim is to reduce the amount of code protected by the try to avoid catching unexpected exceptions. In your case, you could change that part to:

def ask_size():
    while True:
        try:
            grid_size = int(input("input grid length and width\n"))
        except ValueError:
            print ("invalid input") 
        else:
            if grid_size &gt; 1:
                return grid_size
            print ("invalid int")