I've spent the last few hours trying to work out what's wrong with this. I'd be grateful for some help.
dataList = open('data.txt', 'w')
json.dump(data.txt, dataList, indent=4)
vitamin_c=input('Enter milligrams of vitamin c per 100 grams ')
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.
Please follow-up to let us know how you made out. For good karma, mark a reply as the answer if it helped!