[Tutor] Will a dictionary based method work for this problem

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Thu Jul 21 23:13:40 CEST 2005

> This is just a simple example, in my list I have ~40
> sections and ~10K people (this is repeated number and
> I do not know how many unique persons are there).
> Question to tutor:
> Could any one help me proceed further.
> Will a dictionary (key and values ) based method work
> for this kind of problem.

Hi Srivivas,

You may want to consider a relational database approach.  It is possible
to do something like this in straight Python, but you'll be basically
implementing the basic behavior provided by any good relational database.

The kind of queries that you're asking:

    1. Who are the people unique to Accounts?

    2. Who are the people working for two sections of the

are the ad-hoc queries that make relational databases a really big win ---
it should be relatively straightforward to express those questions in SQL.

There are a few free database system you can experiment with, like SQLite,
PostGreSQL, or MySQL:


These systems interact well with Python through Python's DB-API.


Good luck!

More information about the Tutor mailing list