grades = []
names = []
gradeTotal = 0
numStudents = 0

inputFile = open("input.txt", "r"

for line in inputFile:
if line.strip().isdigit():
grade = float(line)
if grade != 0.0:
gradeTotal += grade
grade = grades.append(grade)
else:
name = line.strip()
name = names.append(name)

This just loops over the entire file basically and just continually adds the grades to the grades list and names to the names list. How do I just process each student's set of grades before moving on to the next one (since there is a zero terminating value telling the loop that a new student and his or her grades are about to follow)

By the way I'm not worrying about determining the letter grade average right now, i'm importing a module I wrote after I figure this part out.

On Jul 25, 2009 8:34am, bob gailer <bgai...@gmail.com> wrote:
I concur with wesley and dave re homework.



Some questions to consider:



do you know how to open a file?



do you know how to read a line from an opened file?



do you know how to incorporate reading lines in a loop?



do you know how to determine whether a character is "numeric"?



do you know how to print a line?



what is the criteria for determining A, BC, D, or F average?



--

Bob Gailer

Chapel Hill NC

919-636-4239

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to