Re: [Tutor] Reading Data From File

2009-07-26 Thread Chris Castillo
On 7/26/09, Dave Angel wrote: > Chris Castillo wrote: >> ya i was kind of in a hurry composing the email earlier. sorry for the >> typos and misunderstanding. This is what I actually have. >> >> grades = [] >> names = [] >> gradeTotal = 0 >> numStudents = 0 >> >> inputFile = open("input.txt", "r")

Re: [Tutor] Reading Data From File

2009-07-26 Thread Dave Angel
Chris Castillo wrote: ya i was kind of in a hurry composing the email earlier. sorry for the typos and misunderstanding. This is what I actually have. grades = [] names = [] gradeTotal = 0 numStudents = 0 inputFile = open("input.txt", "r") for line in inputFile: if line.strip().isdigit():

Re: [Tutor] Reading Data From File

2009-07-26 Thread Chris Castillo
ya i was kind of in a hurry composing the email earlier. sorry for the typos and misunderstanding. This is what I actually have. grades = [] names = [] gradeTotal = 0 numStudents = 0 inputFile = open("input.txt", "r") for line in inputFile: if line.strip().isdigit(): grade = float(li

Re: [Tutor] Reading Data From File

2009-07-25 Thread Dave Angel
ctc...@gmail.com wrote: 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(n

Re: [Tutor] Reading Data From File

2009-07-25 Thread ctcast
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 ove

Re: [Tutor] Reading Data From File

2009-07-25 Thread bob gailer
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

Re: [Tutor] Reading Data From File

2009-07-25 Thread Dave Angel
Chris Castillo wrote: Okay I really need help with the program I am writing. I've can't seem to figure out what I need to do and have tried several different methods. I need to read in a text file in python that contains the following: Student Name ( could be unknown amount in file ) Numeric G

Re: [Tutor] Reading Data From File

2009-07-24 Thread wesley chun
On Fri, Jul 24, 2009 at 11:40 PM, Chris Castillo wrote: > Okay I really need help with the program I am writing. I've can't seem to > figure out what I need to do and have tried several different methods. hi chris, and welcome to Python! the tutors here are very helpful to those who are new to pr

[Tutor] Reading Data From File

2009-07-24 Thread Chris Castillo
Okay I really need help with the program I am writing. I've can't seem to figure out what I need to do and have tried several different methods. I need to read in a text file in python that contains the following: Student Name ( could be unknown amount in file ) Numeric Grade ( could be unknown