import sqlite3
import numpy
conn = sqlite3.connect('lotto.db')
cur = conn.cursor()
def fun(a,b,c,d,e,f):
list = [a, b, c ,d, e, f]
print(list)
return numpy.mean(list)
numbers = cur.execute("SELECT * FROM combinations6")
numbers.fetchall()
for row in numbers:
cur.execute("UPDATE combinations6 WHERE id = ? SET average = ?", (row, fun(row[0],row[1],row[2],row[3],row[4],row[5]))
conn.commit()
conn.close()
having trouble getting this to iterate over each row getting syntax errors and when it does run it only calculates the average of the first row and inputs that to all the rows of the database
what am i doing wrong to get it to iterate over each row and calculate the average and input it into the database?
pretty new to python so thanks in advance for your help.