missing 1 required positional argument

I’ve spent the last few hours trying to work out what’s wrong with this. I’d be grateful for some help.

import json

def saveData(dataList):
    dataList = open(‘data.txt’, ‘w’)
    json.dump(data.txt, dataList, indent=4)
   dataList.close()

try:
    trell=open(‘data.txt’, ‘r’)
    data=json.load(trell)
    trell.close()
except:
    data=[]

vitamin_c=input('Enter milligrams of vitamin c per 100 grams ')
data.append({‘vitamin_c’:vitamin_c})
saveData()

For future reference, please identify:

* the language and what version

* where the error is

In the last line you failed to pass a parameter to saveData. Either drop the parameter definition from the method, or pass (presumably) “data” as the parameter.

And if you do the latter, your next problem will be that “saveData” as written doesn’t save the datalist, it loads it.