Hi

I am writing some code for a game in python and using sql to store the information for each of the cells. I keep getting a NameError: name 'row' is not defined error. Could someone please help? Below is a bit of the code:

con.execute("create table Game(row integer primary key, col varchar, content varchar)")
    cur = con.cursor()

    for x in range(5):
            for y in range(5):
                cur.execute("insert into Game(row, col, content) values (?, ?, ?)", [row, col])

In your case x might be the row and y the column.

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.