[Tutor] Reading Data From File

Dave Angel davea at ieee.org
Sat Jul 25 12:26:45 CEST 2009


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 Grade  ( could be unknown amount in file also )
> Numeric Grade
> Numeric Grade
> 0 (zero value to terminate and move on to next student and their grades)
>
> I need to print the following to the screen:
> Student Name    Numeric Grade, Numeric Grade, Numeric grade, etc.. - ( then
> A, B C, D, or F average )
>
> PLEASE HELP ME. I need to put the grades into a list and process each
> student's grades before processing the next student's grades so that I can
> print each Name, their grades, and average on the same line ( like above ).
> Thanks
>
>   
Generally, when I help someone with his homework, I expect him to have 
put some visible effort into solving the problem.

So you've tried several different methods.  Post the code from the most 
likely one of them, with a description of why it isn't doing what you 
needed, and one of us will probably be able to give you a hint to get 
past the trouble spot.

Don't post generalities, but actual code.  The whole thing should be 
less than a dozen lines.

DaveA



More information about the Tutor mailing list