I'm trying to figure out how to set up a grid using a list of lists. I want the input to be x where the program will then setup a list of x lists, each containing x entries, in this case "0"s.

Write

def make_grid(x, value="0"):
    return [[value] * x for i in range(x)]

grid = make_grid(5)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.