Trying to put float() everywhere but i still get the same message.
def getAmountOfCarbon(volume):
carbon = 1.8 + 2 * math.log(volume)
return carbon
carbon = []
for listitem in lists:
carbonlist = getAmountOfCarbon(volume)
carbon.append(carbonlist)
My lists variable is a function:
lists = readCSVfile(str1)
print carbon
TypeError: a float is required
Where should i put my float()?
edit: the volume comes from:
def getVolume(width, height, length):
volume = (width) * (height) * (length)
return volume
edit: I call volume here:
volume = []
for listitem in lists:
volumelist = getVolume(listitem[2], listitem[3], listitem[4])
volume.append(volumelist)
Edit: Solved it in a different way:
def createAnalyseList(lists):
analyselist = []
for item in lists:
height = getHeightType(item[4])
carbon = getAmountOfCarbon(getVolume(item[2],item[3],item[4]))
analyselist.append([item[0], item[1], height, carbon])
print analyselist
return analyselist
analyselist = createAnalyseList(lists)