I am attempting to use SQL in order to make a table currently I have created this
import sqlite3
conn = sqlite3.connect("Classes.db")
c = conn.cursor()
score = 5
name = ("Brad")
Class = 2
def tableCreate():
c.execute("CREATE TABLE Class{}(ID INT, Name TEXT, Score (Out of 10) INT").format(Class)
def dataEntry():
c.execute("INSERT INTO Class{} (Name, Score) VALUES (?,?)",
(score,name)).format(Class)
conn.commit()
When I run the tableCreate function it returns the error:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
tableCreate()
c.execute("CREATE TABLE Class{}(ID INT, Name TEXT, Score (Out of 10)INT").format(Class)
sqlite3.OperationalError: unrecognized token: "{"
I would appreciate any help in resolving this error