[Tutor] I've run into a jam on the exercise on file I/O
falcon3166 at hotmail.com
Wed Aug 3 20:42:36 CEST 2005
I've been chatting with Albertito on MSN and came up with this solution:
int(x), and change student into student ids, and remove #Max. Will this
work, or will I need to add sequential IDs?
----- Original Message -----
From: "Alan G" <alan.gauld at freenet.co.uk>
To: "Nathan Pinno" <falcon3166 at hotmail.com>; "Yoo, Danny"
<dyoo at hkn.eecs.berkeley.edu>; "Bark, Adam" <adam.jtm30 at gmail.com>
Cc: "Tutor" <tutor at python.org>
Sent: Tuesday, August 02, 2005 1:43 AM
Subject: Re: [Tutor] I've run into a jam on the exercise on file I/O
>> What if I were to use ID's for the students and use the ID's as the
>> index, and link the students and their grades to the IDs?
> Its not necessary for what you are doing but it's how you'd normally do it
> in a relational database, so if you ever needed to turn your file based
> program into a full blown database then using IDs would actually help!
> The other thing you could do is hold all the data for a single student
> in one structure. Thus instead of having lots of lists all linked by
> a common index (or ID) you have one collection of students (probably
> a dictionary keyed by name) each with all of its own data. This
> involves a more complex data structure and is a move in the direction
> of object oriented programming but without actual classes and objects
> being involved. This might also allow you to use the shelve moduile
> to save/restore your data to file easily.
> Just a thought,
> Alan G.
More information about the Tutor