How do I make my code look for a name in my list instead of a number? : <p>I have a file called classgrades.txt and it contains student data from a sample class. Each line in the file consists of a student's last name, a space, and a sequence of integers (separated by spaces), which represent scores on assignments.</p>

<p>I am trying to write a Python program to read the data from this file and to write a new file called classscores.txt . Each line of classscores.txt should consist of a student's last name and their average score on the assignments, rounded <strong>down</strong> to the nearest integer.</p>

<p>I've tried to find a way using the length of the list to go through it and once it reaches a name, it stops and takes all the previous numbers and finds the average and puts it next to the name.</p>

<pre class="lang-py prettyprint-override"><code>inFile = open('classgrades.txt','r')

lines = inFile.read()
outFile = open('classcores.txt','w')

fix_list = lines.replace('\n',' ')
new_list = fix_list.split(' ')
length_list = len(new_list) - 1
</code></pre>

<p>Here is what my current list looks like after this code:</p>

<p><code>['Chapman', '90', '100', '85', '66', '80', '55', 'Cleese', '80', '90', '85', '88', 'Gilliam', '78', '82', '80', '80', '75', '77', 'Idle', '91', 'Jones', '68', '90', '22', '100', '0', '80', '85', 'Palin', '80', '90', '80', '90', '']</code></p>

<p>It should output everything nicely in classscores.txt</p>
