trouble putting one function to another
<p>what i'm trying to do is to read each line of the file then put it into other function called handleLine which then creates output, numericgrade calculates the overall percentage and then lettergrade assigns a grade.</p>

<p>for example in file i have 
"name, last name", classid, exam, final
and i want it to output 
full name, score , grade</p>

<pre><code>def main():
    fin=open("scores.csv", "r")
    fout=open("grades.csv", "w")
    fout.write('"Name", "Score", "Grade"\n')
    line=fin.readlines()[1:]
    for line in line:
        line=line.split(",")
        handleLine(line)
        fout.write('"' + lname + "," + fname + '" ,' + score +", " + grade+ ' ", ')

def numericGrade(midterm, final):
    score=0.4*float(midterm) + (0.6 * float(final))
def letterGrade(score):
    grade = None
    if score &gt;= 90:
        grade = "A"
    elif score &gt;= 80:
        grade = "B"
    elif score &gt;=70:
        grade ="C"
    elif score &gt;= 60:
        grade = "D"
    else:
        grade = "F"
def handleLine(line):
    fout=open("grades.csv", "w")
    fname= line[1][1 : -1]
    lname= line[0][1 : ]
    midterm= line[2]
    final = line[3]
    numericGrade(midterm, final)
    score = numericGrade(midterm,final)
    grade = letterGrade(score)
    return lname, fname, score, grade
if __name__=="__main__":
</code></pre>

<p>main()</p>

<p>I'm having trouble putting one function to another, now it says that lname is not defined in line 14. Im really lost now. </p>

<p>EDIT:
I have fixed the </p>

<p>lname, fname, score, grade= handleLine(line)</p>

<p>but i have an error now in line 14</p>

<p>TypeError: cannot concatenate 'str' and 'NoneType' objects</p>
